bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: code = """%(return_type)s %(name)s(%(typed_args)s) {
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: code = """%(return_type)s %(name)s(%(typed_args)s) {
| 475,400
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: code = """%(return_type)s %(name)s(%(typed_args)s) {
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: code = """%(return_type)s %(name)s(%(typed_args)s) {
| 475,401
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size;
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size;
| 475,402
|
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_func = func.GetInfo('ImplFunc') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
|
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" impl_func = func.GetInfo('impl_func') if func.can_auto_generate and (impl_func == None or impl_func == True): file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" helper_->%s(%s);\n" % (func.name, func.MakeOriginalArgString(""))) file.Write("}\n") file.Write("\n") else: file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
| 475,403
|
def __init__(self, platform, options): self._file_dir = path_utils.PathFromBase('webkit', 'tools', 'layout_test') self._platform = platform self._options = options self._rebaselining_tests = [] self._rebaselined_tests = []
|
def __init__(self, platform, options): self._file_dir = path_utils.PathFromBase('webkit', 'tools', 'layout_tests') self._platform = platform self._options = options self._rebaselining_tests = [] self._rebaselined_tests = []
| 475,404
|
def GetActiveNotifications(self): """Gets a list of the currently active/shown HTML5 notifications.
|
def GetActiveNotifications(self): """Gets a list of the currently active/shown HTML5 notifications.
| 475,405
|
def GetActiveNotifications(self): """Gets a list of the currently active/shown HTML5 notifications.
|
def GetActiveNotifications(self): """Gets a list of the currently active/shown HTML5 notifications.
| 475,406
|
def GetActiveNotifications(self): """Gets a list of the currently active/shown HTML5 notifications.
|
def GetActiveNotifications(self): """Gets a list of the currently active/shown HTML5 notifications.
| 475,407
|
def Report(self, files, check_sanity=False): '''Reads in a set of files and prints Memcheck report.
|
def Report(self, files, check_sanity=False): '''Reads in a set of files and prints Memcheck report.
| 475,408
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData' or name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif (name == 'CompressedTexImage2D' or name == 'CompressedTexSubImage2D'): file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D' or name == 'TexSubImage2D': code = """ uint32 data_size;
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData': file.Write(" uint32 data_size = size;\n") elif (name == 'CompressedTexImage2D' or name == 'CompressedTexSubImage2D'): file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D' or name == 'TexSubImage2D': code = """ uint32 data_size;
| 475,409
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData' or name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif (name == 'CompressedTexImage2D' or name == 'CompressedTexSubImage2D'): file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D' or name == 'TexSubImage2D': code = """ uint32 data_size;
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData' or name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'CompressedTexImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D' or name == 'TexSubImage2D': code = """ uint32 data_size;
| 475,410
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData' or name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif (name == 'CompressedTexImage2D' or name == 'CompressedTexSubImage2D'): file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D' or name == 'TexSubImage2D': code = """ uint32 data_size;
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" # TODO(gman): Move this data to _FUNCTION_INFO? name = func.name if name.endswith("Immediate"): name = name[0:-9] if name == 'BufferData' or name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif (name == 'CompressedTexImage2D' or name == 'CompressedTexSubImage2D'): file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D' or name == 'TexSubImage2D': code = """ uint32 data_size;
| 475,411
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size;
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size;
| 475,412
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size;
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size;
| 475,413
|
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg()
|
def WriteServiceImplementation(self, func, file): """Overrriden from TypeHandler.""" file.Write( "error::Error GLES2DecoderImpl::Handle%s(\n" % func.name) file.Write( " uint32 immediate_data_size, const gles2::%s& c) {\n" % func.name) last_arg = func.GetLastOriginalArg()
| 475,414
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size;
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size;
| 475,415
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size;
|
def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size;
| 475,416
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(func_name)s(%(args)s) {
|
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(func_name)s(%(args)s) {
| 475,417
|
def ToolCommand(self): """Get the valgrind command to run.""" tool_name = self.ToolName()
|
def ToolCommand(self): """Get the valgrind command to run.""" tool_name = self.ToolName()
| 475,418
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,419
|
def testSearchWithinSpecialURL(self): """Verify search for text within special URLs such as chrome:history. chrome://history, chrome://downloads, pyAuto Data directory """ zip_file = 'a_zip_file.zip' self.NavigateToURL(self.GetFileURLForPath(self.DataDir())) # search in Data directory self.assertEqual(1, self.FindInPage('downloads', tab_index=0)['match_count']) # search in History page self.AppendTab(pyauto.GURL('chrome://history')) # the contents in the history page load asynchronously after tab loads self.WaitUntil( lambda: self.FindInPage('data', tab_index=1)['match_count'], expect_retval=1) self.assertEqual(1, self.FindInPage('data', tab_index=1)['match_count']) # search in Downloads page test_utils.DownloadFileFromDownloadsDataDir(self, zip_file) self.AppendTab(pyauto.GURL('chrome://downloads')) # the contents in the downloads page load asynchronously after tab loads self.WaitUntil( lambda: self.FindInPage(zip_file, tab_index=2)['match_count'], expect_retval=2) self.assertEqual(2, self.FindInPage(zip_file, tab_index=2)['match_count']) test_utils.RemoveDownloadedTestFile(self, zip_file)
|
def testSearchWithinSpecialURL(self): """Verify search for text within special URLs such as chrome:history. chrome://history, chrome://downloads, pyAuto Data directory """ zip_file = 'a_zip_file.zip' self.NavigateToURL(self.GetFileURLForPath(self.DataDir())) # search in Data directory self.assertEqual(1, self.FindInPage('downloads', tab_index=0)['match_count']) # search in History page self.AppendTab(pyauto.GURL('chrome://history')) # the contents in the history page load asynchronously after tab loads self.WaitUntil( lambda: self.FindInPage(search_query, tab_index=1)['match_count'], expect_retval=1) self.assertEqual(1, self.FindInPage('data', tab_index=1)['match_count']) # search in Downloads page test_utils.DownloadFileFromDownloadsDataDir(self, zip_file) self.AppendTab(pyauto.GURL('chrome://downloads')) # the contents in the downloads page load asynchronously after tab loads self.WaitUntil( lambda: self.FindInPage(zip_file, tab_index=2)['match_count'], expect_retval=2) self.assertEqual(2, self.FindInPage(zip_file, tab_index=2)['match_count']) test_utils.RemoveDownloadedTestFile(self, zip_file)
| 475,420
|
def testSearchWithinSpecialURL(self): """Verify search for text within special URLs such as chrome:history. chrome://history, chrome://downloads, pyAuto Data directory """ zip_file = 'a_zip_file.zip' self.NavigateToURL(self.GetFileURLForPath(self.DataDir())) # search in Data directory self.assertEqual(1, self.FindInPage('downloads', tab_index=0)['match_count']) # search in History page self.AppendTab(pyauto.GURL('chrome://history')) # the contents in the history page load asynchronously after tab loads self.WaitUntil( lambda: self.FindInPage('data', tab_index=1)['match_count'], expect_retval=1) self.assertEqual(1, self.FindInPage('data', tab_index=1)['match_count']) # search in Downloads page test_utils.DownloadFileFromDownloadsDataDir(self, zip_file) self.AppendTab(pyauto.GURL('chrome://downloads')) # the contents in the downloads page load asynchronously after tab loads self.WaitUntil( lambda: self.FindInPage(zip_file, tab_index=2)['match_count'], expect_retval=2) self.assertEqual(2, self.FindInPage(zip_file, tab_index=2)['match_count']) test_utils.RemoveDownloadedTestFile(self, zip_file)
|
def testSearchWithinSpecialURL(self): """Verify search for text within special URLs such as chrome:history. chrome://history, chrome://downloads, pyAuto Data directory """ zip_file = 'a_zip_file.zip' self.NavigateToURL(self.GetFileURLForPath(self.DataDir())) # search in Data directory self.assertEqual(1, self.FindInPage('downloads', tab_index=0)['match_count']) # search in History page self.AppendTab(pyauto.GURL('chrome://history')) # the contents in the history page load asynchronously after tab loads self.WaitUntil( lambda: self.FindInPage('data', tab_index=1)['match_count'], expect_retval=1) self.assertEqual( 1, self.FindInPage(search_query, tab_index=1)['match_count']) # search in Downloads page test_utils.DownloadFileFromDownloadsDataDir(self, zip_file) self.AppendTab(pyauto.GURL('chrome://downloads')) # the contents in the downloads page load asynchronously after tab loads self.WaitUntil( lambda: self.FindInPage(zip_file, tab_index=2)['match_count'], expect_retval=2) self.assertEqual(2, self.FindInPage(zip_file, tab_index=2)['match_count']) test_utils.RemoveDownloadedTestFile(self, zip_file)
| 475,421
|
def _LocateBinDirs(): script_dir = os.path.dirname(__file__) chrome_src = os.path.join(script_dir, os.pardir, os.pardir, os.pardir) # TODO(nirnimesh): Expand this to include win/linux build dirs # crbug.com/32285 bin_dirs = [ os.path.join(chrome_src, 'xcodebuild', 'Debug'), os.path.join(chrome_src, 'xcodebuild', 'Release'), ] for d in bin_dirs: sys.path.append(os.path.normpath(d))
|
def _LocateBinDirs(): script_dir = os.path.dirname(__file__) chrome_src = os.path.join(script_dir, os.pardir, os.pardir, os.pardir) # TODO(nirnimesh): Expand this to include win/linux build dirs # crbug.com/32285 bin_dirs = [ os.path.join(chrome_src, 'xcodebuild', 'Debug'), os.path.join(chrome_src, 'xcodebuild', 'Release'), ] for d in bin_dirs: sys.path.append(os.path.normpath(d))
| 475,422
|
def CheckChangeOnCommit(input_api, output_api): results = [] if not input_api.json: results.append(output_api.PresubmitNotifyResult( 'You don\'t have json nor simplejson installed.\n' ' This is a warning that you will need to upgrade your python ' 'installation.\n' ' This is no big deal but you\'ll eventually need to ' 'upgrade.\n' ' How? Easy! You can do it right now and shut me off! Just:\n' ' del depot_tools\\python.bat\n' ' gclient\n' ' Thanks for your patience.')) results.extend(_CommonChecks(input_api, output_api)) # TODO(thestig) temporarily disabled, doesn't work in third_party/ #results.extend(input_api.canned_checks.CheckSvnModifiedDirectories( # input_api, output_api, sources)) # Make sure the tree is 'open'. results.extend(input_api.canned_checks.CheckTreeIsOpen( input_api, output_api, 'http://chromium-status.appspot.com/current?format=raw', '.*closed.*')) results.extend(input_api.canned_checks.CheckRietveldTryJobExecution(input_api, output_api, 'http://codereview.chromium.org', ('win', 'linux', 'mac'), 'tryserver@chromium.org')) # These builders are just too slow. IGNORED_BUILDERS = [ 'Chromium XP', 'Chromium Mac', 'Chromium Arm (dbg)', 'Chromium Linux', 'Chromium Linux x64', ] results.extend(input_api.canned_checks.CheckBuildbotPendingBuilds( input_api, output_api, 'http://build.chromium.org/buildbot/waterfall/json/builders?filter=1', 6, IGNORED_BUILDERS)) return results
|
def CheckChangeOnCommit(input_api, output_api): results = [] if not input_api.json: results.append(output_api.PresubmitNotifyResult( 'You don\'t have json nor simplejson installed.\n' ' This is a warning that you will need to upgrade your python ' 'installation.\n' ' This is no big deal but you\'ll eventually need to ' 'upgrade.\n' ' How? Easy! You can do it right now and shut me off! Just:\n' ' del depot_tools\\python.bat\n' ' gclient\n' ' Thanks for your patience.')) results.extend(_CommonChecks(input_api, output_api)) # TODO(thestig) temporarily disabled, doesn't work in third_party/ #results.extend(input_api.canned_checks.CheckSvnModifiedDirectories( # input_api, output_api, sources)) # Make sure the tree is 'open'. results.extend(input_api.canned_checks.CheckTreeIsOpen( input_api, output_api, 'http://chromium-status.appspot.com/current?format=raw', '(?i).*closed.*')) results.extend(input_api.canned_checks.CheckRietveldTryJobExecution(input_api, output_api, 'http://codereview.chromium.org', ('win', 'linux', 'mac'), 'tryserver@chromium.org')) # These builders are just too slow. IGNORED_BUILDERS = [ 'Chromium XP', 'Chromium Mac', 'Chromium Arm (dbg)', 'Chromium Linux', 'Chromium Linux x64', ] results.extend(input_api.canned_checks.CheckBuildbotPendingBuilds( input_api, output_api, 'http://build.chromium.org/buildbot/waterfall/json/builders?filter=1', 6, IGNORED_BUILDERS)) return results
| 475,423
|
def _RunCommand(cmd, dry_run, shell=False, echo_cmd=True): """Runs the command if dry_run is false, otherwise just prints the command.""" if echo_cmd: print cmd # TODO(wtc): Check the return value of subprocess.call, which is the return # value of the command. if not dry_run: subprocess.call(cmd, shell=shell)
|
def _RunCommand(cmd, dry_run, shell=False, echo_cmd=True): """Runs the command if dry_run is false, otherwise just prints the command.""" if echo_cmd: print cmd # TODO(wtc): Check the return value of subprocess.call, which is the return # value of the command. if not dry_run: return subprocess.call(cmd, shell=shell) else: return 0
| 475,424
|
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = os.path.join(options.source_dir, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O_RDWR) except OSError, err: print 'Failed to open lock file:\n ' + str(err) return 1 # Write the pid of this script (the python.exe process) to the lock file. os.write(lock_file, str(os.getpid())) options.target = options.target.title() start_time = time.time() print 'Change directory to ' + options.source_dir os.chdir(options.source_dir) # The coverity-password filename may have been a relative path. # If so, assume it's relative to the source directory, which means # the time to read the password is after we do the chdir(). coverity_password = _ReadPassword(options.coverity_password_file) cmd = 'gclient sync' _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) # Do a clean build. Remove the build output directory first. if sys.platform == 'linux2': rm_path = os.path.join(options.source_dir,'src','out',options.target) elif sys.platform == 'win32': rm_path = os.path.join(options.source_dir,options.solution_dir, options.target) elif sys.platform == 'darwin': rm_path = os.path.join(options.source_dir,'src','xcodebuild') else: print 'Platform "%s" unrecognized, don\'t know how to proceed' _ReleaseLock(lock_file, lock_filename) sys.exit(1) if options.dry_run: print 'shutil.rmtree(%s)' % repr(rm_path) else: shutil.rmtree(rm_path,True) print 'Elapsed time: %ds' % (time.time() - start_time) use_shell_during_make = False if sys.platform == 'linux2': use_shell_during_make = True os.chdir('src') _RunCommand('pwd', options.dry_run, shell=True) cmd = '%s/cov-build --dir %s make BUILDTYPE=%s' % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.target) elif sys.platform == 'win32': cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.source_dir, options.solution_file, options.target) elif sys.platform == 'darwin': use_shell_during_make = True os.chdir('src/build') _RunCommand('pwd', options.dry_run, shell=True) cmd = ('%s/cov-build --dir %s xcodebuild -project all.xcodeproj ' '-configuration %s -target All') % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.target) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make) print 'Elapsed time: %ds' % (time.time() - start_time) cov_analyze_exe = os.path.join(options.coverity_bin_dir,'cov-analyze') cmd = '%s --dir %s %s' % (cov_analyze_exe, options.coverity_intermediate_dir, options.coverity_analyze_options) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make) print 'Elapsed time: %ds' % (time.time() - start_time) cov_commit_exe = os.path.join(options.coverity_bin_dir,'cov-commit-defects') # On Linux we have started using a Target with a space in it, so we want # to quote it. On the other hand, Windows quoting doesn't work quite the # same way. To be conservative, I'd like to avoid quoting an argument # that doesn't need quoting and which we haven't historically been quoting # on that platform. So, only quote the target if we have to. coverity_target = options.coverity_target if sys.platform != 'win32': coverity_target = '"%s"' % coverity_target cmd = ('%s --dir %s --remote %s --port %s ' '--product %s ' '--target %s ' '--user %s ' '--password %s') % (cov_commit_exe, options.coverity_intermediate_dir, options.coverity_dbhost, options.coverity_port, options.coverity_product, coverity_target, options.coverity_user, coverity_password) # Avoid echoing the Commit command because it has a password in it _RunCommand(cmd, options.dry_run, shell=use_shell_during_make, echo_cmd=False) print 'Total time: %ds' % (time.time() - start_time) _ReleaseLock(lock_file, lock_filename) return 0
|
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = os.path.join(options.source_dir, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O_RDWR) except OSError, err: print 'Failed to open lock file:\n ' + str(err) return 1 # Write the pid of this script (the python.exe process) to the lock file. os.write(lock_file, str(os.getpid())) options.target = options.target.title() start_time = time.time() print 'Change directory to ' + options.source_dir os.chdir(options.source_dir) # The coverity-password filename may have been a relative path. # If so, assume it's relative to the source directory, which means # the time to read the password is after we do the chdir(). coverity_password = _ReadPassword(options.coverity_password_file) cmd = 'gclient sync' gclient_exit = _RunCommand(cmd, options.dry_run, shell=True) if gclient_exit != 0: print 'gclient aborted with status %s' % gclient_exit _ReleaseLock(lock_file, lock_filename) sys.exit(1) print 'Elapsed time: %ds' % (time.time() - start_time) # Do a clean build. Remove the build output directory first. if sys.platform == 'linux2': rm_path = os.path.join(options.source_dir,'src','out',options.target) elif sys.platform == 'win32': rm_path = os.path.join(options.source_dir,options.solution_dir, options.target) elif sys.platform == 'darwin': rm_path = os.path.join(options.source_dir,'src','xcodebuild') else: print 'Platform "%s" unrecognized, don\'t know how to proceed' _ReleaseLock(lock_file, lock_filename) sys.exit(1) if options.dry_run: print 'shutil.rmtree(%s)' % repr(rm_path) else: shutil.rmtree(rm_path,True) print 'Elapsed time: %ds' % (time.time() - start_time) use_shell_during_make = False if sys.platform == 'linux2': use_shell_during_make = True os.chdir('src') _RunCommand('pwd', options.dry_run, shell=True) cmd = '%s/cov-build --dir %s make BUILDTYPE=%s' % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.target) elif sys.platform == 'win32': cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.source_dir, options.solution_file, options.target) elif sys.platform == 'darwin': use_shell_during_make = True os.chdir('src/build') _RunCommand('pwd', options.dry_run, shell=True) cmd = ('%s/cov-build --dir %s xcodebuild -project all.xcodeproj ' '-configuration %s -target All') % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.target) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make) print 'Elapsed time: %ds' % (time.time() - start_time) cov_analyze_exe = os.path.join(options.coverity_bin_dir,'cov-analyze') cmd = '%s --dir %s %s' % (cov_analyze_exe, options.coverity_intermediate_dir, options.coverity_analyze_options) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make) print 'Elapsed time: %ds' % (time.time() - start_time) cov_commit_exe = os.path.join(options.coverity_bin_dir,'cov-commit-defects') # On Linux we have started using a Target with a space in it, so we want # to quote it. On the other hand, Windows quoting doesn't work quite the # same way. To be conservative, I'd like to avoid quoting an argument # that doesn't need quoting and which we haven't historically been quoting # on that platform. So, only quote the target if we have to. coverity_target = options.coverity_target if sys.platform != 'win32': coverity_target = '"%s"' % coverity_target cmd = ('%s --dir %s --remote %s --port %s ' '--product %s ' '--target %s ' '--user %s ' '--password %s') % (cov_commit_exe, options.coverity_intermediate_dir, options.coverity_dbhost, options.coverity_port, options.coverity_product, coverity_target, options.coverity_user, coverity_password) # Avoid echoing the Commit command because it has a password in it _RunCommand(cmd, options.dry_run, shell=use_shell_during_make, echo_cmd=False) print 'Total time: %ds' % (time.time() - start_time) _ReleaseLock(lock_file, lock_filename) return 0
| 475,425
|
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = os.path.join(options.source_dir, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O_RDWR) except OSError, err: print 'Failed to open lock file:\n ' + str(err) return 1 # Write the pid of this script (the python.exe process) to the lock file. os.write(lock_file, str(os.getpid())) options.target = options.target.title() start_time = time.time() print 'Change directory to ' + options.source_dir os.chdir(options.source_dir) # The coverity-password filename may have been a relative path. # If so, assume it's relative to the source directory, which means # the time to read the password is after we do the chdir(). coverity_password = _ReadPassword(options.coverity_password_file) cmd = 'gclient sync' _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) # Do a clean build. Remove the build output directory first. if sys.platform == 'linux2': rm_path = os.path.join(options.source_dir,'src','out',options.target) elif sys.platform == 'win32': rm_path = os.path.join(options.source_dir,options.solution_dir, options.target) elif sys.platform == 'darwin': rm_path = os.path.join(options.source_dir,'src','xcodebuild') else: print 'Platform "%s" unrecognized, don\'t know how to proceed' _ReleaseLock(lock_file, lock_filename) sys.exit(1) if options.dry_run: print 'shutil.rmtree(%s)' % repr(rm_path) else: shutil.rmtree(rm_path,True) print 'Elapsed time: %ds' % (time.time() - start_time) use_shell_during_make = False if sys.platform == 'linux2': use_shell_during_make = True os.chdir('src') _RunCommand('pwd', options.dry_run, shell=True) cmd = '%s/cov-build --dir %s make BUILDTYPE=%s' % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.target) elif sys.platform == 'win32': cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.source_dir, options.solution_file, options.target) elif sys.platform == 'darwin': use_shell_during_make = True os.chdir('src/build') _RunCommand('pwd', options.dry_run, shell=True) cmd = ('%s/cov-build --dir %s xcodebuild -project all.xcodeproj ' '-configuration %s -target All') % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.target) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make) print 'Elapsed time: %ds' % (time.time() - start_time) cov_analyze_exe = os.path.join(options.coverity_bin_dir,'cov-analyze') cmd = '%s --dir %s %s' % (cov_analyze_exe, options.coverity_intermediate_dir, options.coverity_analyze_options) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make) print 'Elapsed time: %ds' % (time.time() - start_time) cov_commit_exe = os.path.join(options.coverity_bin_dir,'cov-commit-defects') # On Linux we have started using a Target with a space in it, so we want # to quote it. On the other hand, Windows quoting doesn't work quite the # same way. To be conservative, I'd like to avoid quoting an argument # that doesn't need quoting and which we haven't historically been quoting # on that platform. So, only quote the target if we have to. coverity_target = options.coverity_target if sys.platform != 'win32': coverity_target = '"%s"' % coverity_target cmd = ('%s --dir %s --remote %s --port %s ' '--product %s ' '--target %s ' '--user %s ' '--password %s') % (cov_commit_exe, options.coverity_intermediate_dir, options.coverity_dbhost, options.coverity_port, options.coverity_product, coverity_target, options.coverity_user, coverity_password) # Avoid echoing the Commit command because it has a password in it _RunCommand(cmd, options.dry_run, shell=use_shell_during_make, echo_cmd=False) print 'Total time: %ds' % (time.time() - start_time) _ReleaseLock(lock_file, lock_filename) return 0
|
def main(options, args): """Runs all the selected tests for the given build type and target.""" # Create the lock file to prevent another instance of this script from # running. lock_filename = os.path.join(options.source_dir, LOCK_FILE) try: lock_file = os.open(lock_filename, os.O_CREAT | os.O_EXCL | os.O_TRUNC | os.O_RDWR) except OSError, err: print 'Failed to open lock file:\n ' + str(err) return 1 # Write the pid of this script (the python.exe process) to the lock file. os.write(lock_file, str(os.getpid())) options.target = options.target.title() start_time = time.time() print 'Change directory to ' + options.source_dir os.chdir(options.source_dir) # The coverity-password filename may have been a relative path. # If so, assume it's relative to the source directory, which means # the time to read the password is after we do the chdir(). coverity_password = _ReadPassword(options.coverity_password_file) cmd = 'gclient sync' _RunCommand(cmd, options.dry_run, shell=True) print 'Elapsed time: %ds' % (time.time() - start_time) # Do a clean build. Remove the build output directory first. if sys.platform == 'linux2': rm_path = os.path.join(options.source_dir,'src','out',options.target) elif sys.platform == 'win32': rm_path = os.path.join(options.source_dir,options.solution_dir, options.target) elif sys.platform == 'darwin': rm_path = os.path.join(options.source_dir,'src','xcodebuild') else: print 'Platform "%s" unrecognized, aborting' % sys.platform _ReleaseLock(lock_file, lock_filename) sys.exit(1) if options.dry_run: print 'shutil.rmtree(%s)' % repr(rm_path) else: shutil.rmtree(rm_path,True) print 'Elapsed time: %ds' % (time.time() - start_time) use_shell_during_make = False if sys.platform == 'linux2': use_shell_during_make = True os.chdir('src') _RunCommand('pwd', options.dry_run, shell=True) cmd = '%s/cov-build --dir %s make BUILDTYPE=%s' % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.target) elif sys.platform == 'win32': cmd = '%s\\cov-build.exe --dir %s devenv.com %s\\%s /build %s' % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.source_dir, options.solution_file, options.target) elif sys.platform == 'darwin': use_shell_during_make = True os.chdir('src/build') _RunCommand('pwd', options.dry_run, shell=True) cmd = ('%s/cov-build --dir %s xcodebuild -project all.xcodeproj ' '-configuration %s -target All') % ( options.coverity_bin_dir, options.coverity_intermediate_dir, options.target) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make) print 'Elapsed time: %ds' % (time.time() - start_time) cov_analyze_exe = os.path.join(options.coverity_bin_dir,'cov-analyze') cmd = '%s --dir %s %s' % (cov_analyze_exe, options.coverity_intermediate_dir, options.coverity_analyze_options) _RunCommand(cmd, options.dry_run, shell=use_shell_during_make) print 'Elapsed time: %ds' % (time.time() - start_time) cov_commit_exe = os.path.join(options.coverity_bin_dir,'cov-commit-defects') # On Linux we have started using a Target with a space in it, so we want # to quote it. On the other hand, Windows quoting doesn't work quite the # same way. To be conservative, I'd like to avoid quoting an argument # that doesn't need quoting and which we haven't historically been quoting # on that platform. So, only quote the target if we have to. coverity_target = options.coverity_target if sys.platform != 'win32': coverity_target = '"%s"' % coverity_target cmd = ('%s --dir %s --remote %s --port %s ' '--product %s ' '--target %s ' '--user %s ' '--password %s') % (cov_commit_exe, options.coverity_intermediate_dir, options.coverity_dbhost, options.coverity_port, options.coverity_product, coverity_target, options.coverity_user, coverity_password) # Avoid echoing the Commit command because it has a password in it _RunCommand(cmd, options.dry_run, shell=use_shell_during_make, echo_cmd=False) print 'Total time: %ds' % (time.time() - start_time) _ReleaseLock(lock_file, lock_filename) return 0
| 475,426
|
def main(argv): actions = set() AddComputedActions(actions) # TODO(fmantek): bring back webkit editor actions. # AddWebKitEditorActions(actions) # Walk the source tree to process all .cc files. chrome_root = os.path.join(path_utils.ScriptDir(), '..') WalkDirectory(chrome_root, actions) webkit_root = os.path.join(path_utils.ScriptDir(), '..', '..', 'webkit') WalkDirectory(os.path.join(webkit_root, 'glue'), actions) WalkDirectory(os.path.join(webkit_root, 'port'), actions) # print "Scanned {0} number of files".format(number_of_files_total) # print "Found {0} entries".format(len(actions)) # Print out the actions as a sorted list. for action in sorted(actions): print action
|
def main(argv): actions = set() AddComputedActions(actions) # TODO(fmantek): bring back webkit editor actions. # AddWebKitEditorActions(actions) # Walk the source tree to process all .cc files. chrome_root = os.path.join(path_utils.ScriptDir(), '..') WalkDirectory(chrome_root, actions) webkit_root = os.path.join(path_utils.ScriptDir(), '..', '..', 'webkit') WalkDirectory(os.path.join(webkit_root, 'glue'), actions) WalkDirectory(os.path.join(webkit_root, 'port'), actions) # print "Scanned {0} number of files".format(number_of_files_total) # print "Found {0} entries".format(len(actions)) # Print out the actions as a sorted list. for action in sorted(actions): if hash_output: hash = hashlib.md5() hash.update(action) print >>f, '0x%s\t%s' % (hash.hexdigest()[:16], action) else: print action if hash_output: print "Done. Do not forget to add chromeactions.txt to your changelist"
| 475,427
|
def _GetDeniedOrigins(self): """Gets the list of origins that are explicitly denied to create notifications. """ return self.GetPrefsInfo().Prefs(pyauto.kDesktopNotificationDeniedOrigins)
|
def _GetDeniedOrigins(self): """Gets the list of origins that are explicitly denied to create notifications. """ return self.GetPrefsInfo().Prefs(pyauto.kDesktopNotificationDeniedOrigins)
| 475,428
|
def _GetAllowedOrigins(self): """Gets the list of origins that are explicitly allowed to create notifications. """ return self.GetPrefsInfo().Prefs(pyauto.kDesktopNotificationAllowedOrigins)
|
def _GetAllowedOrigins(self): """Gets the list of origins that are explicitly allowed to create notifications. """ return self.GetPrefsInfo().Prefs(pyauto.kDesktopNotificationAllowedOrigins)
| 475,429
|
def _DenyOrigin(self, new_origin): """Denies the given origin to create notifications.
|
def _DenyOrigin(self, new_origin): """Denies the given origin to create notifications.
| 475,430
|
def _AllowOrigin(self, new_origin): """Allows the given origin to create notifications. If it was explicitly denied, that preference is dropped. """ self._DropOriginPreference(new_origin) allowed = self._GetAllowedOrigins() or [] if new_origin not in allowed: self._SetAllowedOrigins(allowed + [new_origin])
|
def _AllowOrigin(self, new_origin): """Allows the given origin to create notifications. If it was explicitly denied, that preference is dropped. """ self._DropOriginPreference(new_origin) allowed = self._GetAllowedOrigins() if new_origin not in allowed: self._SetAllowedOrigins(allowed + [new_origin])
| 475,431
|
def _CreateSimpleNotification(self, img_url, title, text, replace_id='', tab_index=0, windex=0): """Creates a simple notification.
|
def _CreateSimpleNotification(self, img_url, title, text, replace_id='', tab_index=0, windex=0): """Creates a simple notification.
| 475,432
|
def _CreateHTMLNotification(self, content_url, replace_id='', tab_index=0, windex=0): """Creates an HTML notification.
|
def _CreateHTMLNotification(self, content_url, replace_id='', tab_index=0, windex=0): """Creates an HTML notification.
| 475,433
|
def _RequestPermission(self, tab_index=0, windex=0): """Requests permission to create notifications.
|
def _RequestPermission(self, tab_index=0, windex=0): """Requests permission to create notifications.
| 475,434
|
def testAllowOnPermissionInfobar(self): """Tries to create a notification and clicks allow on the infobar.""" self.NavigateToURL(self.TEST_PAGE_URL) # This notification should not be shown because we do not have permission. self._CreateHTMLNotification(self.NO_SUCH_URL) self.assertFalse(self.GetActiveNotifications())
|
def testAllowOnPermissionInfobar(self): """Tries to create a notification and clicks allow on the infobar.""" self.NavigateToURL(self.TEST_PAGE_URL) # This notification should not be shown because we do not have permission. self._CreateHTMLNotification(self.NO_SUCH_URL) self.assertFalse(self.GetActiveNotifications())
| 475,435
|
def get_num_cores(): """Returns the number of cores on the machine. For hyperthreaded machines, this will be double the number of actual processors.""" return int(os.popen2("sysctl -n hw.ncpu")[1].read())
|
def get_num_cores(): """Returns the number of cores on the machine. For hyperthreaded machines, this will be double the number of actual processors.""" cmd = ['/usr/sbin/sysctl', '-n', 'hw.ncpu'] return int(subprocess.Popen(cmd, stdout=subprocess.PIPE).stdout.read())
| 475,436
|
def check(self, path, expectedUrl, expectedChannel): actual = self.getSrcUrl(path) if (actual[0] != expectedUrl): self.response.out.write('<span style="color:#f00;">Failure:</span> path ' + path + " gave url " + actual[0] + "<br/>") elif (actual[1] != expectedChannel): self.response.out.write('<span style="color:#f00;">Failure:</span> path ' + path + " gave branch " + actual[1].name + "<br/>") else: self.response.out.write("Path " + path + ' <span style="color:#0f0;">OK</span><br/>') return
|
def check(self, path, expectedUrl, expectedChannel): actual = self.getSrcUrl(path) if (actual[0] != expectedUrl): self.response.out.write('<span style="color:#f00;">Failure:</span> path ' + path + " gave url " + actual[0] + "<br/>") elif (actual[1] != expectedChannel): self.response.out.write('<span style="color:#f00;">Failure:</span> path ' + path + " gave branch " + actual[1].name + "<br/>") else: self.response.out.write("Path " + path + ' <span style="color:#0f0;">OK</span><br/>') return
| 475,437
|
def RunTests(self): """Run all unit tests and generate appropriate lcov files.""" self.BeforeRunAllTests() for fulltest in self.tests: if not os.path.exists(fulltest): logging.info(fulltest + ' does not exist') if self.options.strict: sys.exit(2) else: logging.info('%s path exists' % fulltest) cmdlist = [fulltest, '--gtest_print_time']
|
def RunTests(self): """Run all unit tests and generate appropriate lcov files.""" self.BeforeRunAllTests() for fulltest in self.tests: if not os.path.exists(fulltest): logging.info(fulltest + ' does not exist') if self.options.strict: sys.exit(2) else: logging.info('%s path exists' % fulltest) cmdlist = [fulltest, '--gtest_print_time']
| 475,438
|
def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, "ipc": self.TestIpc, "ipc_tests": self.TestIpc, "layout": self.TestLayout, "layout_tests": self.TestLayout, "media": self.TestMedia, "media_unittests": self.TestMedia, "net": self.TestNet, "net_unittests": self.TestNet, "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, "startup": self.TestStartup, "startup_tests": self.TestStartup, "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, "ui": self.TestUI, "ui_tests": self.TestUI, "unit": self.TestUnit, "unit_tests": self.TestUnit, "app": self.TestApp, "app_unittests": self.TestApp, }
|
def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestGURL, "googleurl_unittests": self.TestGURL, "ipc": self.TestIpc, "ipc_tests": self.TestIpc, "layout": self.TestLayout, "layout_tests": self.TestLayout, "media": self.TestMedia, "media_unittests": self.TestMedia, "net": self.TestNet, "net_unittests": self.TestNet, "printing": self.TestPrinting, "printing_unittests": self.TestPrinting, "startup": self.TestStartup, "startup_tests": self.TestStartup, "test_shell": self.TestTestShell, "test_shell_tests": self.TestTestShell, "ui": self.TestUI, "ui_tests": self.TestUI, "unit": self.TestUnit, "unit_tests": self.TestUnit, "app": self.TestApp, "app_unittests": self.TestApp, }
| 475,439
|
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CHeaderWriter(filename) enums = sorted(_ENUM_LISTS.keys()) for enum in enums: file.Write("static %s valid_%s_table[] = {\n" % (_ENUM_LISTS[enum]['type'], ToUnderscore(enum))) for value in _ENUM_LISTS[enum]['valid']: file.Write(" %s,\n" % value) file.Write("};\n") file.Write("\n") file.Write("Validators::Validators()\n") pre = ': ' post = ',' count = 0 for enum in enums: count += 1 if count == len(enums): post = ' {' code = """ %(pre)s%(name)s( valid_%(name)s_table, arraysize(valid_%(name)s_table))%(post)s
|
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CHeaderWriter(filename) enums = sorted(_ENUM_LISTS.keys()) for enum in enums: if len(_ENUM_LISTS[enum]['valid']) > 0: file.Write("static %s valid_%s_table[] = {\n" % (_ENUM_LISTS[enum]['type'], ToUnderscore(enum))) for value in _ENUM_LISTS[enum]['valid']: file.Write(" %s,\n" % value) file.Write("};\n") file.Write("\n") file.Write("Validators::Validators()\n") pre = ': ' post = ',' count = 0 for enum in enums: count += 1 if count == len(enums): post = ' {' code = """ %(pre)s%(name)s( valid_%(name)s_table, arraysize(valid_%(name)s_table))%(post)s
| 475,440
|
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CHeaderWriter(filename) enums = sorted(_ENUM_LISTS.keys()) for enum in enums: file.Write("static %s valid_%s_table[] = {\n" % (_ENUM_LISTS[enum]['type'], ToUnderscore(enum))) for value in _ENUM_LISTS[enum]['valid']: file.Write(" %s,\n" % value) file.Write("};\n") file.Write("\n") file.Write("Validators::Validators()\n") pre = ': ' post = ',' count = 0 for enum in enums: count += 1 if count == len(enums): post = ' {' code = """ %(pre)s%(name)s( valid_%(name)s_table, arraysize(valid_%(name)s_table))%(post)s
|
def WriteServiceUtilsImplementation(self, filename): """Writes the gles2 auto generated utility implementation.""" file = CHeaderWriter(filename) enums = sorted(_ENUM_LISTS.keys()) for enum in enums: file.Write("static %s valid_%s_table[] = {\n" % (_ENUM_LISTS[enum]['type'], ToUnderscore(enum))) for value in _ENUM_LISTS[enum]['valid']: file.Write(" %s,\n" % value) file.Write("};\n") file.Write("\n") file.Write("Validators::Validators()\n") pre = ': ' post = ',' count = 0 for enum in enums: count += 1 if count == len(enums): post = ' {' code = """ %(pre)s%(name)s( valid_%(name)s_table, arraysize(valid_%(name)s_table))%(post)s
| 475,441
|
def WriteGetCode(self, file): """Overridden from Argument.""" code = """ %(type)s %(name)s = c.%(name)s;
|
def WriteGetCode(self, file): """Overridden from Argument.""" code = """ %(type)s %(name)s = c.%(name)s;
| 475,442
|
def main(): cmd = [sys.executable] src_dir = sys.argv[0]; if sys.platform != 'cygwin': src_dir = os.path.abspath(sys.argv[0]) print src_dir src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(src_dir))))) script_dir=os.path.join(src_dir, "third_party", "WebKit", "WebKitTools", "Scripts") script = os.path.join(script_dir, 'new-run-webkit-tests') cmd.append(script) if '--chromium' not in sys.argv: cmd.append('--chromium') cmd.extend(sys.argv[1:]) return subprocess.call(cmd)
|
def main(): cmd = [sys.executable] src_dir = os.path.abspath(os.path.join(sys.path[0], '..', '..', '..')) script_dir=os.path.join(src_dir, "third_party", "WebKit", "WebKitTools", "Scripts") script = os.path.join(script_dir, 'new-run-webkit-tests') cmd.append(script) if '--chromium' not in sys.argv: cmd.append('--chromium') cmd.extend(sys.argv[1:]) return subprocess.call(cmd)
| 475,443
|
def GetSolutionPath(self): """Gets the solution path.""" return '%s_main.scons' % GypBuilder.base_name
|
def GetSolutionPath(self): """Gets the solution path.""" return '%s_main.scons' % GypBuilder.base_name
| 475,444
|
def CleanTargets(self, targets, options): """Cleans the targets.""" solution = self.GetSolutionPath() self.Execute(['hammer', '-f', solution, '--clean'])
|
def CleanTargets(self, targets, options): """Cleans the targets.""" solution = self.GetSolutionPath() self.Execute(['hammer', '-f', solution, '--clean'])
| 475,445
|
def Dobuild(self, targets, options): """Builds the specifed targets.""" solution = self.GetSolutionPath() self.Execute(['hammer', '-f', solution])
|
def Dobuild(self, targets, options): """Builds the specifed targets.""" solution = self.GetSolutionPath() self.Execute(['hammer', '-f', solution])
| 475,446
|
def _locateManifestsFromPath(self, path): """ Returns a list of paths to sample extension manifest.json files.
|
def _locateManifestsFromPath(self, path): """ Returns a list of paths to sample extension manifest.json files.
| 475,447
|
def _parse_api_calls(self, api_methods): """ Returns a list of Chrome extension API calls the sample makes.
|
def _parse_api_calls(self, api_methods): """ Returns a list of Chrome extension API calls the sample makes.
| 475,448
|
def _parse_source_files(self): """ Returns a list of paths to source files present in the extenion.
|
def _parse_source_files(self): """ Returns a list of paths to source files present in the extenion.
| 475,449
|
def write_zip(self): """ Writes a zip file containing all of the files in this Sample's dir.""" sample_path = os.path.realpath(os.path.dirname(self._manifest_path)) sample_dirname = os.path.basename(sample_path) sample_parentpath = os.path.dirname(sample_path)
|
def write_zip(self): """ Writes a zip file containing all of the files in this Sample's dir.""" sample_path = os.path.realpath(os.path.dirname(self._manifest_path)) sample_dirname = os.path.basename(sample_path) sample_parentpath = os.path.dirname(sample_path)
| 475,450
|
def write_zip(self): """ Writes a zip file containing all of the files in this Sample's dir.""" sample_path = os.path.realpath(os.path.dirname(self._manifest_path)) sample_dirname = os.path.basename(sample_path) sample_parentpath = os.path.dirname(sample_path)
|
def write_zip(self): """ Writes a zip file containing all of the files in this Sample's dir.""" sample_path = os.path.realpath(os.path.dirname(self._manifest_path)) sample_dirname = os.path.basename(sample_path) sample_parentpath = os.path.dirname(sample_path)
| 475,451
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
|
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
| 475,452
|
def GetReports(self, files): '''Extracts reports from a set of files.
|
def GetReports(self, files): '''Extracts reports from a set of files.
| 475,453
|
def EchoAllHandler(self): """This handler yields a (more) human-readable page listing information about the request header & contents."""
|
def EchoAllHandler(self): """This handler yields a (more) human-readable page listing information about the request header & contents."""
| 475,454
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,455
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,456
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
deflisten_port = server.server_port main(options,listen_port = server.server_port args):listen_port = server.server_port logfilelisten_port = server.server_port =listen_port = server.server_port open('testserver.log',listen_port = server.server_port 'w')listen_port = server.server_port sys.stdoutlisten_port = server.server_port =listen_port = server.server_port FileMultiplexer(sys.stdout,listen_port = server.server_port logfile)listen_port = server.server_port sys.stderrlisten_port = server.server_port =listen_port = server.server_port FileMultiplexer(sys.stderr,listen_port = server.server_port logfile)listen_port = server.server_port listen_port = server.server_port portlisten_port = server.server_port =listen_port = server.server_port options.portlisten_port = server.server_port listen_port = server.server_port iflisten_port = server.server_port options.server_typelisten_port = server.server_port ==listen_port = server.server_port SERVER_HTTP:listen_port = server.server_port iflisten_port = server.server_port options.cert:listen_port = server.server_port #listen_port = server.server_port let'slisten_port = server.server_port makelisten_port = server.server_port surelisten_port = server.server_port thelisten_port = server.server_port certlisten_port = server.server_port filelisten_port = server.server_port exists.listen_port = server.server_port iflisten_port = server.server_port notlisten_port = server.server_port os.path.isfile(options.cert):listen_port = server.server_port printlisten_port = server.server_port 'specifiedlisten_port = server.server_port serverlisten_port = server.server_port certlisten_port = server.server_port filelisten_port = server.server_port notlisten_port = server.server_port found:listen_port = server.server_port 'listen_port = server.server_port +listen_port = server.server_port options.certlisten_port = server.server_port +listen_port = server.server_port \listen_port = server.server_port 'listen_port = server.server_port exiting...'listen_port = server.server_port returnlisten_port = server.server_port forlisten_port = server.server_port ca_certlisten_port = server.server_port inlisten_port = server.server_port options.ssl_client_ca:listen_port = server.server_port iflisten_port = server.server_port notlisten_port = server.server_port os.path.isfile(ca_cert):listen_port = server.server_port printlisten_port = server.server_port 'specifiedlisten_port = server.server_port trustedlisten_port = server.server_port clientlisten_port = server.server_port CAlisten_port = server.server_port filelisten_port = server.server_port notlisten_port = server.server_port found:listen_port = server.server_port 'listen_port = server.server_port +listen_port = server.server_port ca_certlisten_port = server.server_port +listen_port = server.server_port \listen_port = server.server_port 'listen_port = server.server_port exiting...'listen_port = server.server_port returnlisten_port = server.server_port serverlisten_port = server.server_port =listen_port = server.server_port HTTPSServer(('127.0.0.1',listen_port = server.server_port port),listen_port = server.server_port TestPageHandler,listen_port = server.server_port options.cert,listen_port = server.server_port options.ssl_client_auth,listen_port = server.server_port options.ssl_client_ca,listen_port = server.server_port options.ssl_bulk_cipher)listen_port = server.server_port printlisten_port = server.server_port 'HTTPSlisten_port = server.server_port serverlisten_port = server.server_port startedlisten_port = server.server_port onlisten_port = server.server_port portlisten_port = server.server_port %d...'listen_port = server.server_port %listen_port = server.server_port portlisten_port = server.server_port else:listen_port = server.server_port serverlisten_port = server.server_port =listen_port = server.server_port StoppableHTTPServer(('127.0.0.1',listen_port = server.server_port port),listen_port = server.server_port TestPageHandler)listen_port = server.server_port printlisten_port = server.server_port 'HTTPlisten_port = server.server_port serverlisten_port = server.server_port startedlisten_port = server.server_port onlisten_port = server.server_port portlisten_port = server.server_port %d...'listen_port = server.server_port %listen_port = server.server_port portlisten_port = server.server_port listen_port = server.server_port server.data_dirlisten_port = server.server_port =listen_port = server.server_port MakeDataDir()listen_port = server.server_port server.file_root_urllisten_port = server.server_port =listen_port = server.server_port options.file_root_urllisten_port = server.server_port server._sync_handlerlisten_port = server.server_port =listen_port = server.server_port Nonelisten_port = server.server_port listen_port = server.server_port #listen_port = server.server_port meanslisten_port = server.server_port FTPlisten_port = server.server_port Serverlisten_port = server.server_port else:listen_port = server.server_port my_data_dirlisten_port = server.server_port =listen_port = server.server_port MakeDataDir()listen_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Instantiatelisten_port = server.server_port alisten_port = server.server_port dummylisten_port = server.server_port authorizerlisten_port = server.server_port forlisten_port = server.server_port managinglisten_port = server.server_port 'virtual'listen_port = server.server_port userslisten_port = server.server_port authorizerlisten_port = server.server_port =listen_port = server.server_port pyftpdlib.ftpserver.DummyAuthorizer()listen_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Definelisten_port = server.server_port alisten_port = server.server_port newlisten_port = server.server_port userlisten_port = server.server_port havinglisten_port = server.server_port fulllisten_port = server.server_port r/wlisten_port = server.server_port permissionslisten_port = server.server_port andlisten_port = server.server_port alisten_port = server.server_port read-onlylisten_port = server.server_port #listen_port = server.server_port anonymouslisten_port = server.server_port userlisten_port = server.server_port authorizer.add_user('chrome',listen_port = server.server_port 'chrome',listen_port = server.server_port my_data_dir,listen_port = server.server_port perm='elradfmw')listen_port = server.server_port listen_port = server.server_port authorizer.add_anonymous(my_data_dir)listen_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Instantiatelisten_port = server.server_port FTPlisten_port = server.server_port handlerlisten_port = server.server_port classlisten_port = server.server_port ftp_handlerlisten_port = server.server_port =listen_port = server.server_port pyftpdlib.ftpserver.FTPHandlerlisten_port = server.server_port ftp_handler.authorizerlisten_port = server.server_port =listen_port = server.server_port authorizerlisten_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Definelisten_port = server.server_port alisten_port = server.server_port customizedlisten_port = server.server_port bannerlisten_port = server.server_port (stringlisten_port = server.server_port returnedlisten_port = server.server_port whenlisten_port = server.server_port clientlisten_port = server.server_port connects)listen_port = server.server_port ftp_handler.bannerlisten_port = server.server_port =listen_port = server.server_port ("pyftpdliblisten_port = server.server_port %slisten_port = server.server_port basedlisten_port = server.server_port ftpdlisten_port = server.server_port ready."listen_port = server.server_port %listen_port = server.server_port pyftpdlib.ftpserver.__ver__)listen_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Instantiatelisten_port = server.server_port FTPlisten_port = server.server_port serverlisten_port = server.server_port classlisten_port = server.server_port andlisten_port = server.server_port listenlisten_port = server.server_port tolisten_port = server.server_port 127.0.0.1:portlisten_port = server.server_port addresslisten_port = server.server_port =listen_port = server.server_port ('127.0.0.1',listen_port = server.server_port port)listen_port = server.server_port serverlisten_port = server.server_port =listen_port = server.server_port pyftpdlib.ftpserver.FTPServer(address,listen_port = server.server_port ftp_handler)listen_port = server.server_port printlisten_port = server.server_port 'FTPlisten_port = server.server_port serverlisten_port = server.server_port startedlisten_port = server.server_port onlisten_port = server.server_port portlisten_port = server.server_port %d...'listen_port = server.server_port %listen_port = server.server_port portlisten_port = server.server_port listen_port = server.server_port #listen_port = server.server_port Notifylisten_port = server.server_port thelisten_port = server.server_port parentlisten_port = server.server_port thatlisten_port = server.server_port we'velisten_port = server.server_port started.listen_port = server.server_port (BaseServerlisten_port = server.server_port subclasseslisten_port = server.server_port #listen_port = server.server_port bindlisten_port = server.server_port theirlisten_port = server.server_port socketslisten_port = server.server_port onlisten_port = server.server_port construction.)listen_port = server.server_port iflisten_port = server.server_port options.startup_pipelisten_port = server.server_port islisten_port = server.server_port notlisten_port = server.server_port None:listen_port = server.server_port iflisten_port = server.server_port sys.platformlisten_port = server.server_port ==listen_port = server.server_port 'win32':listen_port = server.server_port fdlisten_port = server.server_port =listen_port = server.server_port msvcrt.open_osfhandle(options.startup_pipe,listen_port = server.server_port 0)listen_port = server.server_port else:listen_port = server.server_port fdlisten_port = server.server_port =listen_port = server.server_port options.startup_pipelisten_port = server.server_port startup_pipelisten_port = server.server_port =listen_port = server.server_port os.fdopen(fd,listen_port = server.server_port "w")listen_port = server.server_port startup_pipe.write("READY")listen_port = server.server_port startup_pipe.close()listen_port = server.server_port listen_port = server.server_port try:listen_port = server.server_port server.serve_forever()listen_port = server.server_port exceptlisten_port = server.server_port KeyboardInterrupt:listen_port = server.server_port printlisten_port = server.server_port 'shuttinglisten_port = server.server_port downlisten_port = server.server_port server'listen_port = server.server_port server.stoplisten_port = server.server_port =listen_port = server.server_port Truelisten_port = server.server_port
| 475,457
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,458
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,459
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") startup_pipe.write("READY") startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,460
|
def testInlinAutoComplete(self): """Verify inline autocomplete for a pre-visited url.""" self.NavigateToURL('http://www.google.com') matches = self._GetOmniboxMatchesFor('goog') self.assertTrue(matches) # Omnibox should suggest auto completed url as the first item matches_description = matches[0] self.assertTrue('www.google.com' in matches_description['contents']) self.assertEqual('history-url', matches_description['type']) # The url should be inline-autocompleted in the omnibox self.assertEqual('google.com/', self.GetOmniboxInfo().Text())
|
def testInlinAutoComplete(self): """Verify inline autocomplete for a pre-visited url.""" self.NavigateToURL('http://www.google.com') matches = self._GetOmniboxMatchesFor('goog') self.assertTrue(matches) # Omnibox should suggest auto completed url as the first item matches_description = matches[0] self.assertTrue('www.google.com' in matches_description['contents']) self.assertEqual('history-url', matches_description['type']) # The url should be inline-autocompleted in the omnibox self.assertEqual('google.com/', self.GetOmniboxInfo().Text())
| 475,461
|
def ParseCommandLine(): """Constructs and configures an option parser for this script and parses the command line arguments. Returns: The parsed options. """ parser = optparse.OptionParser('Usage: %prog [options] <files>') parser.add_option('-i', '--input', dest='input', help='An archive file to append to.') parser.add_option('-o', '--output', dest='output', help='Output file for archive.') parser.add_option('-p', '--path', dest='path', help='Path within the archive to write the files to.') (options, args) = parser.parse_args() if not options.output: parser.error('You must provide an output file.') return (options, args)
|
def ParseCommandLine(): """Constructs and configures an option parser for this script and parses the command line arguments. Returns: The parsed options. """ parser = optparse.OptionParser(usage=_USAGE, description=_DESCRIPTION) parser.add_option('-i', '--input', dest='input', help='An archive file to append to.') parser.add_option('-o', '--output', dest='output', help='Output file for archive.') parser.add_option('-p', '--path', dest='path', help='Path within the archive to write the files to.') (options, args) = parser.parse_args() if not options.output: parser.error('You must provide an output file.') return (options, args)
| 475,462
|
def Main(): """Zip input arguments to Zip output archive.""" (options, args) = ParseCommandLine() # Test that all the input files exist before we blow the output archive away # only to fail part way. for path in args: if not os.path.exists(path): raise Exception('Input file does not exist:', path) if os.path.isdir(path): raise Exception('Input file is a path:', path) # Open the output file. if options.input: shutil.copyfile(options.input, options.output) mode = 'a' else: mode = 'w' output = zipfile.ZipFile(options.output, mode, zipfile.ZIP_DEFLATED) # Add the files to the output archive. for path in args: if options.path: output.write(path, os.path.join(options.path, os.path.basename(path))) else: output.write(path) output.close() return 0
|
def Main(): """Zip input arguments to Zip output archive.""" (options, args) = ParseCommandLine() # Test that all the input files exist before we blow the output archive away # only to fail part way. for path in args: if not os.path.exists(path): raise Exception('Input file does not exist:', path) if os.path.isdir(path): raise Exception('Input file is a path:', path) # Open the output file. if options.input: shutil.copyfile(options.input, options.output) mode = 'a' else: mode = 'w' output = zipfile.ZipFile(options.output, mode, zipfile.ZIP_DEFLATED) # Add the files to the output archive. for path in args: if path == _DEBUG_ONLY_FILE_SEPARATOR: if options.config != 'Debug': break elif options.path: output.write(path, os.path.join(options.path, os.path.basename(path))) else: output.write(path) output.close() return 0
| 475,463
|
def testInstantNavigation(self): """Test that instant navigates based on omnibox input.""" self.SetOmniboxText('google.com') self.assertTrue(self.WaitUntil(self._DoneLoading)) location = self.GetInstantInfo()['location'] self.assertTrue(location.startswith('http://www.google.com'))
|
def testInstantNavigation(self): """Test that instant navigates based on omnibox input.""" self.SetOmniboxText('google.com') self.assertTrue(self.WaitUntil(self._DoneLoading)) location = self.GetInstantInfo()['location'] self.assertTrue(location.startswith('http://www.google.com'))
| 475,464
|
def testInstantNavigation(self): """Test that instant navigates based on omnibox input.""" self.SetOmniboxText('google.com') self.assertTrue(self.WaitUntil(self._DoneLoading)) location = self.GetInstantInfo()['location'] self.assertTrue(location.startswith('http://www.google.com'))
|
def testInstantNavigation(self): """Test that instant navigates based on omnibox input.""" self.SetOmniboxText('google.com') self.assertTrue(self.WaitUntil(self._DoneLoading)) location = self.GetInstantInfo()['location'] self.assertTrue(location.startswith('http://www.google.com'))
| 475,465
|
def testInstantNavigation(self): """Test that instant navigates based on omnibox input.""" self.SetOmniboxText('google.com') self.assertTrue(self.WaitUntil(self._DoneLoading)) location = self.GetInstantInfo()['location'] self.assertTrue(location.startswith('http://www.google.com'))
|
def testInstantNavigation(self): """Test that instant navigates based on omnibox input.""" self.SetOmniboxText('google.com') self.assertTrue(self.WaitUntil(self._DoneLoading)) location = self.GetInstantInfo()['location'] self.assertTrue(location.startswith('http://www.google.com'))
| 475,466
|
def EchoAllHandler(self): """This handler yields a (more) human-readable page listing information about the request header & contents."""
|
def EchoAllHandler(self): """This handler yields a (more) human-readable page listing information about the request header & contents."""
| 475,467
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,468
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,469
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,470
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) print 'FTP server started on port %d...' % port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,471
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,472
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url server._sync_handler = None listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,473
|
def _ReadGtestFilterFile(self, name, cmd): '''Read a file which is a list of tests to filter out with --gtest_filter and append the command-line option to cmd. ''' filters = [] for directory in self._data_dirs: gtest_filter_files = [ os.path.join(directory, name + ".gtest.txt"), os.path.join(directory, name + ".gtest-%s.txt" % \ self._options.valgrind_tool)] for platform_suffix in common.PlatformNames(): gtest_filter_files += [ os.path.join(directory, name + ".gtest_%s.txt" % platform_suffix), os.path.join(directory, name + ".gtest-%s_%s.txt" % \ (self._options.valgrind_tool, platform_suffix))] for filename in gtest_filter_files: if os.path.exists(filename): logging.info("reading gtest filters from %s" % filename) f = open(filename, 'r') for line in f.readlines(): if line.startswith("#") or line.startswith("//") or line.isspace(): continue line = line.rstrip() test_prefixes = ["FLAKY", "FAILS", "MAYBE"] for p in test_prefixes: # Strip prefixes from the test names. line = line.replace(".%s_" % p, ".") # Exclude the original test name. filters.append(line) if line[-2:] != ".*": # List all possible prefixes if line doesn't end with ".*". for p in test_prefixes: filters.append(line.replace(".", ".%s_" % p)) # Get rid of duplicates. filters = set(filters) gtest_filter = self._gtest_filter if len(filters): if gtest_filter: gtest_filter += ":" if gtest_filter.find("-") < 0: gtest_filter += "-" else: gtest_filter = "-" gtest_filter += ":".join(filters) if gtest_filter: cmd.append("--gtest_filter=%s" % gtest_filter)
|
def _ReadGtestFilterFile(self, name, cmd): '''Read a file which is a list of tests to filter out with --gtest_filter and append the command-line option to cmd. ''' filters = [] for directory in self._data_dirs: gtest_filter_files = [ os.path.join(directory, name + ".gtest.txt"), os.path.join(directory, name + ".gtest-%s.txt" % \ self._options.valgrind_tool)] for platform_suffix in common.PlatformNames(): gtest_filter_files += [ os.path.join(directory, name + ".gtest_%s.txt" % platform_suffix), os.path.join(directory, name + ".gtest-%s_%s.txt" % \ (self._options.valgrind_tool, platform_suffix))] for filename in gtest_filter_files: if os.path.exists(filename): logging.info("reading gtest filters from %s" % filename) f = open(filename, 'r') for line in f.readlines(): if line.startswith("#") or line.startswith("//") or line.isspace(): continue line = line.rstrip() test_prefixes = ["FLAKY", "FAILS"] for p in test_prefixes: # Strip prefixes from the test names. line = line.replace(".%s_" % p, ".") # Exclude the original test name. filters.append(line) if line[-2:] != ".*": # List all possible prefixes if line doesn't end with ".*". for p in test_prefixes: filters.append(line.replace(".", ".%s_" % p)) # Get rid of duplicates. filters = set(filters) gtest_filter = self._gtest_filter if len(filters): if gtest_filter: gtest_filter += ":" if gtest_filter.find("-") < 0: gtest_filter += "-" else: gtest_filter = "-" gtest_filter += ":".join(filters) if gtest_filter: cmd.append("--gtest_filter=%s" % gtest_filter)
| 475,474
|
def testAddSearchEngine(self): """Test searching using keyword of user-added search engine.""" self.AddSearchEngine(title='foo', keyword='foo.com', url='http://foo/?q=%s') self.SetOmniboxText('foo.com foobar') self.OmniboxAcceptInput() self.assertEqual('http://foo/?q=foobar', self.GetActiveTabURL().spec())
|
def testAddSearchEngine(self): """Test searching using keyword of user-added search engine.""" self.AddSearchEngine(title='foo', keyword='foo.com', url='http://localhost/?q=%s') self.SetOmniboxText('foo.com foobar') self.OmniboxAcceptInput() self.assertEqual('http://foo/?q=foobar', self.GetActiveTabURL().spec())
| 475,475
|
def testAddSearchEngine(self): """Test searching using keyword of user-added search engine.""" self.AddSearchEngine(title='foo', keyword='foo.com', url='http://foo/?q=%s') self.SetOmniboxText('foo.com foobar') self.OmniboxAcceptInput() self.assertEqual('http://foo/?q=foobar', self.GetActiveTabURL().spec())
|
def testAddSearchEngine(self): """Test searching using keyword of user-added search engine.""" self.AddSearchEngine(title='foo', keyword='foo.com', url='http://foo/?q=%s') self.SetOmniboxText('foo.com foobar') self.OmniboxAcceptInput() self.assertEqual('http://foo/?q=foobar', self.GetActiveTabURL().spec())
| 475,476
|
def testEditSearchEngine(self): """Test editing a search engine's properties.""" self.AddSearchEngine(title='foo', keyword='foo.com', url='http://foo/?q=%s') self.EditSearchEngine(keyword='foo.com', new_title='bar', new_keyword='bar.com', new_url='http://foo/?bar=true&q=%s') self.assertTrue(self._GetSearchEngineWithKeyword('bar.com')) self.assertFalse(self._GetSearchEngineWithKeyword('foo.com')) self.SetOmniboxText('bar.com foobar') self.OmniboxAcceptInput() self.assertEqual('http://foo/?bar=true&q=foobar', self.GetActiveTabURL().spec())
|
def testEditSearchEngine(self): """Test editing a search engine's properties.""" self.AddSearchEngine(title='foo', keyword='foo.com', url='http://foo/?q=%s') self.EditSearchEngine(keyword='foo.com', new_title='bar', new_keyword='bar.com', new_url='http://localhost/?bar=true&q=%s') self.assertTrue(self._GetSearchEngineWithKeyword('bar.com')) self.assertFalse(self._GetSearchEngineWithKeyword('foo.com')) self.SetOmniboxText('bar.com foobar') self.OmniboxAcceptInput() self.assertEqual('http://foo/?bar=true&q=foobar', self.GetActiveTabURL().spec())
| 475,477
|
def testEditSearchEngine(self): """Test editing a search engine's properties.""" self.AddSearchEngine(title='foo', keyword='foo.com', url='http://foo/?q=%s') self.EditSearchEngine(keyword='foo.com', new_title='bar', new_keyword='bar.com', new_url='http://foo/?bar=true&q=%s') self.assertTrue(self._GetSearchEngineWithKeyword('bar.com')) self.assertFalse(self._GetSearchEngineWithKeyword('foo.com')) self.SetOmniboxText('bar.com foobar') self.OmniboxAcceptInput() self.assertEqual('http://foo/?bar=true&q=foobar', self.GetActiveTabURL().spec())
|
def testEditSearchEngine(self): """Test editing a search engine's properties.""" self.AddSearchEngine(title='foo', keyword='foo.com', url='http://foo/?q=%s') self.EditSearchEngine(keyword='foo.com', new_title='bar', new_keyword='bar.com', new_url='http://foo/?bar=true&q=%s') self.assertTrue(self._GetSearchEngineWithKeyword('bar.com')) self.assertFalse(self._GetSearchEngineWithKeyword('foo.com')) self.SetOmniboxText('bar.com foobar') self.OmniboxAcceptInput() self.assertEqual('http://localhost/?bar=true&q=foobar', self.GetActiveTabURL().spec())
| 475,478
|
def testMakeSearchEngineDefault(self): """Test adding then making a search engine default.""" self.AddSearchEngine( title='foo', keyword='foo.com', url='http://foo/?q=%s') foo = self._GetSearchEngineWithKeyword('foo.com') self.assertTrue(foo) self.assertFalse(foo['is_default']) self.MakeSearchEngineDefault('foo.com') foo = self._GetSearchEngineWithKeyword('foo.com') self.assertTrue(foo) self.assertTrue(foo['is_default']) self.SetOmniboxText('foobar') self.OmniboxAcceptInput() self.assertEqual('http://foo/?q=foobar', self.GetActiveTabURL().spec())
|
def testMakeSearchEngineDefault(self): """Test adding then making a search engine default.""" self.AddSearchEngine( title='foo', keyword='foo.com', url='http://localhost/?q=%s') foo = self._GetSearchEngineWithKeyword('foo.com') self.assertTrue(foo) self.assertFalse(foo['is_default']) self.MakeSearchEngineDefault('foo.com') foo = self._GetSearchEngineWithKeyword('foo.com') self.assertTrue(foo) self.assertTrue(foo['is_default']) self.SetOmniboxText('foobar') self.OmniboxAcceptInput() self.assertEqual('http://foo/?q=foobar', self.GetActiveTabURL().spec())
| 475,479
|
def testMakeSearchEngineDefault(self): """Test adding then making a search engine default.""" self.AddSearchEngine( title='foo', keyword='foo.com', url='http://foo/?q=%s') foo = self._GetSearchEngineWithKeyword('foo.com') self.assertTrue(foo) self.assertFalse(foo['is_default']) self.MakeSearchEngineDefault('foo.com') foo = self._GetSearchEngineWithKeyword('foo.com') self.assertTrue(foo) self.assertTrue(foo['is_default']) self.SetOmniboxText('foobar') self.OmniboxAcceptInput() self.assertEqual('http://foo/?q=foobar', self.GetActiveTabURL().spec())
|
def testMakeSearchEngineDefault(self): """Test adding then making a search engine default.""" self.AddSearchEngine( title='foo', keyword='foo.com', url='http://foo/?q=%s') foo = self._GetSearchEngineWithKeyword('foo.com') self.assertTrue(foo) self.assertFalse(foo['is_default']) self.MakeSearchEngineDefault('foo.com') foo = self._GetSearchEngineWithKeyword('foo.com') self.assertTrue(foo) self.assertTrue(foo['is_default']) self.SetOmniboxText('foobar') self.OmniboxAcceptInput() self.assertEqual('http://localhost/?q=foobar', self.GetActiveTabURL().spec())
| 475,480
|
def IsWhiteListedExtension(file_path): """Returns True if file_path has an extension we want to ignore.""" return WHITELIST_EXTENSIONS_REGEX.match(os.path.splitext(file_path)[1])
|
def IsWhiteListedExtension(file_path): """Returns True if file_path has an extension we want to ignore.""" return WHITELIST_EXTENSIONS_REGEX.match(os.path.splitext(file_path)[1])
| 475,481
|
def CheckFile(file_path): """Checks file_path's permissions. Args: file_path: The file path to check. Returns: Either a string describing the error if there was one, or None if the file checked out OK. """ if VERBOSE: print 'Checking file: ' + file_path file_path_lower = file_path.lower() # Check to see if it's whitelisted. if IsWhiteListedExtension(file_path_lower): return None if IsWhiteListedPath(file_path_lower): return None if IsWhiteListedRegex(file_path_lower): return None # Not whitelisted, stat the file and check permissions. try: st_mode = os.stat(file_path).st_mode except IOError, e: return 'Failed to stat file: %s' % e except OSError, e: return 'Failed to stat file: %s' % e if EXECUTABLE_PERMISSION & st_mode: error = 'Contains executable permission' if VERBOSE: return '%s: %06o' % (error, st_mode) return error return None
|
def CheckFile(file_path): """Checks file_path's permissions. Args: file_path: The file path to check. Returns: Either a string describing the error if there was one, or None if the file checked out OK. """ if VERBOSE: print 'Checking file: ' + file_path file_path_lower = file_path.lower() # Check to see if it's whitelisted.if IsWhiteListed(file_path_lower): return None # Not whitelisted, stat the file and check permissions. try: st_mode = os.stat(file_path).st_mode except IOError, e: return 'Failed to stat file: %s' % e except OSError, e: return 'Failed to stat file: %s' % e if EXECUTABLE_PERMISSION & st_mode: error = 'Contains executable permission' if VERBOSE: return '%s: %06o' % (error, st_mode) return error return None
| 475,482
|
def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid())
|
def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid())
| 475,483
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: server_data = { 'port': listen_port } server_data_json = simplejson.dumps(server_data) if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: server_data = { 'port': listen_port } server_data_json = simplejson.dumps(server_data) if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,484
|
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
|
def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '') output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json output_dir = posixpath.dirname(output) output_file.write(" {\n") output_file.write(" 'action_name': '%s',\n" % name) output_file.write(" 'inputs': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) output_file.write(" ],\n") output_file.write(" 'outputs': [\n") if sys.platform[:5] == 'linux': # TODO(gspencer): This is a HACK! We shouldn't need to put the # absolute path here, but currently on Linux (scons), it is unable # to copy generated items out of the source tree (because the # repository mojo fails to find it and puts in the wrong path). output_file.write(" '%s',\n" % posixpath.abspath(output)) else: output_file.write(" '../samples/%s',\n" % output) output_file.write(" ],\n") output_file.write(" 'action': [\n") output_file.write(" '<(PRODUCT_DIR)/o3dConverter',\n") output_file.write(" '--no-condition',\n") output_file.write(" '--up-axis=%s',\n" % asset['up']) if webgl_mode: output_file.write(" '--no-binary',\n") output_file.write(" '--no-archive',\n") output_file.write(" '--convert-dds-to-png',\n") output_file.write(" '--convert-cg-to-glsl',\n") output_file.write(" '../o3d_assets/samples/%s',\n" % asset['path']) if webgl_mode: output_file.write(" '../samples/%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") output_file.write(" ],\n") output_file.write(" },\n")
| 475,485
|
def ApplyDirectoryRules(existing_rules, dir_name): """Combines rules from the existing rules and the new directory. Any directory can contain a DEPS file. Toplevel DEPS files can contain module dependencies which are used by gclient. We use these, along with additional include rules and implicit rules for the given directory, to come up with a combined set of rules to apply for the directory. Args: existing_rules: The rules for the parent directory. We'll add-on to these. dir_name: The directory name that the deps file may live in (if it exists). This will also be used to generate the implicit rules. Returns: A tuple containing: (1) the combined set of rules to apply to the sub-tree, and (2) a list of all subdirectories that should NOT be checked, as specified in the DEPS file (if any). """ # Check for a .svn directory in this directory or check this directory is # contained in git source direcotries. This will tell us if it's a source # directory and should be checked. if not (os.path.exists(os.path.join(dir_name, ".svn")) or (dir_name in GIT_SOURCE_DIRECTORY)): return (None, []) # Check the DEPS file in this directory. if VERBOSE: print "Applying rules from", dir_name def FromImpl(unused): pass # NOP function so "From" doesn't fail. class _VarImpl: def __init__(self, local_scope): self._local_scope = local_scope def Lookup(self, var_name): """Implements the Var syntax.""" if var_name in self._local_scope.get("vars", {}): return self._local_scope["vars"][var_name] raise Error("Var is not defined: %s" % var_name) local_scope = {} global_scope = {"From": FromImpl, "Var": _VarImpl(local_scope).Lookup} deps_file = os.path.join(dir_name, "DEPS") if os.path.isfile(deps_file): execfile(deps_file, global_scope, local_scope) elif VERBOSE: print " No deps file found in", dir_name # Even if a DEPS file does not exist we still invoke ApplyRules # to apply the implicit "allow" rule for the current directory deps = local_scope.get(DEPS_VAR_NAME, {}) include_rules = local_scope.get(INCLUDE_RULES_VAR_NAME, []) skip_subdirs = local_scope.get(SKIP_SUBDIRS_VAR_NAME, []) return (ApplyRules(existing_rules, deps, include_rules, dir_name), skip_subdirs)
|
def ApplyDirectoryRules(existing_rules, dir_name): """Combines rules from the existing rules and the new directory. Any directory can contain a DEPS file. Toplevel DEPS files can contain module dependencies which are used by gclient. We use these, along with additional include rules and implicit rules for the given directory, to come up with a combined set of rules to apply for the directory. Args: existing_rules: The rules for the parent directory. We'll add-on to these. dir_name: The directory name that the deps file may live in (if it exists). This will also be used to generate the implicit rules. Returns: A tuple containing: (1) the combined set of rules to apply to the sub-tree, and (2) a list of all subdirectories that should NOT be checked, as specified in the DEPS file (if any). """ # Check for a .svn directory in this directory or check this directory is # contained in git source direcotries. This will tell us if it's a source # directory and should be checked. if not (os.path.exists(os.path.join(dir_name, ".svn")) or (dir_name.lower() in GIT_SOURCE_DIRECTORY)): return (None, []) # Check the DEPS file in this directory. if VERBOSE: print "Applying rules from", dir_name def FromImpl(unused): pass # NOP function so "From" doesn't fail. class _VarImpl: def __init__(self, local_scope): self._local_scope = local_scope def Lookup(self, var_name): """Implements the Var syntax.""" if var_name in self._local_scope.get("vars", {}): return self._local_scope["vars"][var_name] raise Error("Var is not defined: %s" % var_name) local_scope = {} global_scope = {"From": FromImpl, "Var": _VarImpl(local_scope).Lookup} deps_file = os.path.join(dir_name, "DEPS") if os.path.isfile(deps_file): execfile(deps_file, global_scope, local_scope) elif VERBOSE: print " No deps file found in", dir_name # Even if a DEPS file does not exist we still invoke ApplyRules # to apply the implicit "allow" rule for the current directory deps = local_scope.get(DEPS_VAR_NAME, {}) include_rules = local_scope.get(INCLUDE_RULES_VAR_NAME, []) skip_subdirs = local_scope.get(SKIP_SUBDIRS_VAR_NAME, []) return (ApplyRules(existing_rules, deps, include_rules, dir_name), skip_subdirs)
| 475,486
|
def CollectTranslatedStrings(): """Collects all the translations for all the strings specified by kStringIds. Returns a list of tuples of (string_id, language, translated string). The list is sorted by language codes.""" kGeneratedResourcesPath = os.path.join(path_utils.ScriptDir(), '..', '..', '..', 'app/google_chrome_strings.grd') kTranslationDirectory = os.path.join(path_utils.ScriptDir(), '..', '..', '..', 'app', 'resources') kTranslationFiles = glob.glob(os.path.join(kTranslationDirectory, 'google_chrome_strings*.xtb')) # Get the strings out of generated_resources.grd. dom = minidom.parse(kGeneratedResourcesPath) # message_nodes is a list of message dom nodes corresponding to the string # ids we care about. We want to make sure that this list is in the same # order as kStringIds so we can associate them together. message_nodes = [] all_message_nodes = dom.getElementsByTagName('message') for string_id in kStringIds: message_nodes.append([x for x in all_message_nodes if x.getAttribute('name') == string_id][0]) message_texts = [node.firstChild.nodeValue.strip() for node in message_nodes] # The fingerprint of the string is the message ID in the translation files # (xtb files). translation_ids = [str(FP.FingerPrint(text)) for text in message_texts] # Manually put _EN_US in the list of translated strings because it doesn't # have a .xtb file. translated_strings = [] for string_id, message_text in zip(kStringIds, message_texts): translated_strings.append(TranslationStruct(string_id + '_EN_US', 'EN_US', message_text)) # Gather the translated strings from the .xtb files. If an .xtb file doesn't # have the string we want, use the en-US string. for xtb_filename in kTranslationFiles: dom = minidom.parse(xtb_filename) language = dom.documentElement.getAttribute('lang') language = language.replace('-', '_').upper() translation_nodes = {} for translation_node in dom.getElementsByTagName('translation'): translation_id = translation_node.getAttribute('id') if translation_id in translation_ids: translation_nodes[translation_id] = (translation_node.firstChild .nodeValue .strip()) for i, string_id in enumerate(kStringIds): translated_string = translation_nodes.get(translation_ids[i], message_texts[i]) translated_strings.append(TranslationStruct(string_id + '_' + language, language, translated_string)) translated_strings.sort() return translated_strings
|
def CollectTranslatedStrings(branding): """Collects all the translations for all the strings specified by kStringIds. Returns a list of tuples of (string_id, language, translated string). The list is sorted by language codes.""" kGeneratedResourcesPath = os.path.join(path_utils.ScriptDir(), '..', '..', '..', 'app/google_chrome_strings.grd') kTranslationDirectory = os.path.join(path_utils.ScriptDir(), '..', '..', '..', 'app', 'resources') kTranslationFiles = glob.glob(os.path.join(kTranslationDirectory, 'google_chrome_strings*.xtb')) # Get the strings out of generated_resources.grd. dom = minidom.parse(kGeneratedResourcesPath) # message_nodes is a list of message dom nodes corresponding to the string # ids we care about. We want to make sure that this list is in the same # order as kStringIds so we can associate them together. message_nodes = [] all_message_nodes = dom.getElementsByTagName('message') for string_id in kStringIds: message_nodes.append([x for x in all_message_nodes if x.getAttribute('name') == string_id][0]) message_texts = [node.firstChild.nodeValue.strip() for node in message_nodes] # The fingerprint of the string is the message ID in the translation files # (xtb files). translation_ids = [str(FP.FingerPrint(text)) for text in message_texts] # Manually put _EN_US in the list of translated strings because it doesn't # have a .xtb file. translated_strings = [] for string_id, message_text in zip(kStringIds, message_texts): translated_strings.append(TranslationStruct(string_id + '_EN_US', 'EN_US', message_text)) # Gather the translated strings from the .xtb files. If an .xtb file doesn't # have the string we want, use the en-US string. for xtb_filename in kTranslationFiles: dom = minidom.parse(xtb_filename) language = dom.documentElement.getAttribute('lang') language = language.replace('-', '_').upper() translation_nodes = {} for translation_node in dom.getElementsByTagName('translation'): translation_id = translation_node.getAttribute('id') if translation_id in translation_ids: translation_nodes[translation_id] = (translation_node.firstChild .nodeValue .strip()) for i, string_id in enumerate(kStringIds): translated_string = translation_nodes.get(translation_ids[i], message_texts[i]) translated_strings.append(TranslationStruct(string_id + '_' + language, language, translated_string)) translated_strings.sort() return translated_strings
| 475,487
|
def CollectTranslatedStrings(): """Collects all the translations for all the strings specified by kStringIds. Returns a list of tuples of (string_id, language, translated string). The list is sorted by language codes.""" kGeneratedResourcesPath = os.path.join(path_utils.ScriptDir(), '..', '..', '..', 'app/google_chrome_strings.grd') kTranslationDirectory = os.path.join(path_utils.ScriptDir(), '..', '..', '..', 'app', 'resources') kTranslationFiles = glob.glob(os.path.join(kTranslationDirectory, 'google_chrome_strings*.xtb')) # Get the strings out of generated_resources.grd. dom = minidom.parse(kGeneratedResourcesPath) # message_nodes is a list of message dom nodes corresponding to the string # ids we care about. We want to make sure that this list is in the same # order as kStringIds so we can associate them together. message_nodes = [] all_message_nodes = dom.getElementsByTagName('message') for string_id in kStringIds: message_nodes.append([x for x in all_message_nodes if x.getAttribute('name') == string_id][0]) message_texts = [node.firstChild.nodeValue.strip() for node in message_nodes] # The fingerprint of the string is the message ID in the translation files # (xtb files). translation_ids = [str(FP.FingerPrint(text)) for text in message_texts] # Manually put _EN_US in the list of translated strings because it doesn't # have a .xtb file. translated_strings = [] for string_id, message_text in zip(kStringIds, message_texts): translated_strings.append(TranslationStruct(string_id + '_EN_US', 'EN_US', message_text)) # Gather the translated strings from the .xtb files. If an .xtb file doesn't # have the string we want, use the en-US string. for xtb_filename in kTranslationFiles: dom = minidom.parse(xtb_filename) language = dom.documentElement.getAttribute('lang') language = language.replace('-', '_').upper() translation_nodes = {} for translation_node in dom.getElementsByTagName('translation'): translation_id = translation_node.getAttribute('id') if translation_id in translation_ids: translation_nodes[translation_id] = (translation_node.firstChild .nodeValue .strip()) for i, string_id in enumerate(kStringIds): translated_string = translation_nodes.get(translation_ids[i], message_texts[i]) translated_strings.append(TranslationStruct(string_id + '_' + language, language, translated_string)) translated_strings.sort() return translated_strings
|
def CollectTranslatedStrings(): """Collects all the translations for all the strings specified by kStringIds. Returns a list of tuples of (string_id, language, translated string). The list is sorted by language codes.""" kGeneratedResourcesPath = os.path.join(path_utils.ScriptDir(), '..', '..', '..', strings_file) kTranslationDirectory = os.path.join(path_utils.ScriptDir(), '..', '..', '..', 'app', 'resources') kTranslationFiles = glob.glob(os.path.join(kTranslationDirectory, 'google_chrome_strings*.xtb')) # Get the strings out of generated_resources.grd. dom = minidom.parse(kGeneratedResourcesPath) # message_nodes is a list of message dom nodes corresponding to the string # ids we care about. We want to make sure that this list is in the same # order as kStringIds so we can associate them together. message_nodes = [] all_message_nodes = dom.getElementsByTagName('message') for string_id in kStringIds: message_nodes.append([x for x in all_message_nodes if x.getAttribute('name') == string_id][0]) message_texts = [node.firstChild.nodeValue.strip() for node in message_nodes] # The fingerprint of the string is the message ID in the translation files # (xtb files). translation_ids = [str(FP.FingerPrint(text)) for text in message_texts] # Manually put _EN_US in the list of translated strings because it doesn't # have a .xtb file. translated_strings = [] for string_id, message_text in zip(kStringIds, message_texts): translated_strings.append(TranslationStruct(string_id + '_EN_US', 'EN_US', message_text)) # Gather the translated strings from the .xtb files. If an .xtb file doesn't # have the string we want, use the en-US string. for xtb_filename in kTranslationFiles: dom = minidom.parse(xtb_filename) language = dom.documentElement.getAttribute('lang') language = language.replace('-', '_').upper() translation_nodes = {} for translation_node in dom.getElementsByTagName('translation'): translation_id = translation_node.getAttribute('id') if translation_id in translation_ids: translation_nodes[translation_id] = (translation_node.firstChild .nodeValue .strip()) for i, string_id in enumerate(kStringIds): translated_string = translation_nodes.get(translation_ids[i], message_texts[i]) translated_strings.append(TranslationStruct(string_id + '_' + language, language, translated_string)) translated_strings.sort() return translated_strings
| 475,488
|
def CollectTranslatedStrings(): """Collects all the translations for all the strings specified by kStringIds. Returns a list of tuples of (string_id, language, translated string). The list is sorted by language codes.""" kGeneratedResourcesPath = os.path.join(path_utils.ScriptDir(), '..', '..', '..', 'app/google_chrome_strings.grd') kTranslationDirectory = os.path.join(path_utils.ScriptDir(), '..', '..', '..', 'app', 'resources') kTranslationFiles = glob.glob(os.path.join(kTranslationDirectory, 'google_chrome_strings*.xtb')) # Get the strings out of generated_resources.grd. dom = minidom.parse(kGeneratedResourcesPath) # message_nodes is a list of message dom nodes corresponding to the string # ids we care about. We want to make sure that this list is in the same # order as kStringIds so we can associate them together. message_nodes = [] all_message_nodes = dom.getElementsByTagName('message') for string_id in kStringIds: message_nodes.append([x for x in all_message_nodes if x.getAttribute('name') == string_id][0]) message_texts = [node.firstChild.nodeValue.strip() for node in message_nodes] # The fingerprint of the string is the message ID in the translation files # (xtb files). translation_ids = [str(FP.FingerPrint(text)) for text in message_texts] # Manually put _EN_US in the list of translated strings because it doesn't # have a .xtb file. translated_strings = [] for string_id, message_text in zip(kStringIds, message_texts): translated_strings.append(TranslationStruct(string_id + '_EN_US', 'EN_US', message_text)) # Gather the translated strings from the .xtb files. If an .xtb file doesn't # have the string we want, use the en-US string. for xtb_filename in kTranslationFiles: dom = minidom.parse(xtb_filename) language = dom.documentElement.getAttribute('lang') language = language.replace('-', '_').upper() translation_nodes = {} for translation_node in dom.getElementsByTagName('translation'): translation_id = translation_node.getAttribute('id') if translation_id in translation_ids: translation_nodes[translation_id] = (translation_node.firstChild .nodeValue .strip()) for i, string_id in enumerate(kStringIds): translated_string = translation_nodes.get(translation_ids[i], message_texts[i]) translated_strings.append(TranslationStruct(string_id + '_' + language, language, translated_string)) translated_strings.sort() return translated_strings
|
def CollectTranslatedStrings(): """Collects all the translations for all the strings specified by kStringIds. Returns a list of tuples of (string_id, language, translated string). The list is sorted by language codes.""" kGeneratedResourcesPath = os.path.join(path_utils.ScriptDir(), '..', '..', '..', 'app/google_chrome_strings.grd') kTranslationDirectory = os.path.join(path_utils.ScriptDir(), '..', '..', '..', 'app', 'resources') kTranslationFiles = glob.glob(os.path.join(kTranslationDirectory, translation_files)) # Get the strings out of generated_resources.grd. dom = minidom.parse(kGeneratedResourcesPath) # message_nodes is a list of message dom nodes corresponding to the string # ids we care about. We want to make sure that this list is in the same # order as kStringIds so we can associate them together. message_nodes = [] all_message_nodes = dom.getElementsByTagName('message') for string_id in kStringIds: message_nodes.append([x for x in all_message_nodes if x.getAttribute('name') == string_id][0]) message_texts = [node.firstChild.nodeValue.strip() for node in message_nodes] # The fingerprint of the string is the message ID in the translation files # (xtb files). translation_ids = [str(FP.FingerPrint(text)) for text in message_texts] # Manually put _EN_US in the list of translated strings because it doesn't # have a .xtb file. translated_strings = [] for string_id, message_text in zip(kStringIds, message_texts): translated_strings.append(TranslationStruct(string_id + '_EN_US', 'EN_US', message_text)) # Gather the translated strings from the .xtb files. If an .xtb file doesn't # have the string we want, use the en-US string. for xtb_filename in kTranslationFiles: dom = minidom.parse(xtb_filename) language = dom.documentElement.getAttribute('lang') language = language.replace('-', '_').upper() translation_nodes = {} for translation_node in dom.getElementsByTagName('translation'): translation_id = translation_node.getAttribute('id') if translation_id in translation_ids: translation_nodes[translation_id] = (translation_node.firstChild .nodeValue .strip()) for i, string_id in enumerate(kStringIds): translated_string = translation_nodes.get(translation_ids[i], message_texts[i]) translated_strings.append(TranslationStruct(string_id + '_' + language, language, translated_string)) translated_strings.sort() return translated_strings
| 475,489
|
def main(argv): translated_strings = CollectTranslatedStrings() kFilebase = os.path.join(argv[1], 'installer_util_strings') WriteRCFile(translated_strings, kFilebase) WriteHeaderFile(translated_strings, kFilebase)
|
def main(argv): branding = '' if (argv > 2): branding = argv[2] translated_strings = CollectTranslatedStrings(branding) kFilebase = os.path.join(argv[1], 'installer_util_strings') WriteRCFile(translated_strings, kFilebase) WriteHeaderFile(translated_strings, kFilebase)
| 475,490
|
def main(argv): translated_strings = CollectTranslatedStrings() kFilebase = os.path.join(argv[1], 'installer_util_strings') WriteRCFile(translated_strings, kFilebase) WriteHeaderFile(translated_strings, kFilebase)
|
def main(argv): translated_strings = CollectTranslatedStrings() kFilebase = os.path.join(argv[1], 'installer_util_strings') WriteRCFile(translated_strings, kFilebase) WriteHeaderFile(translated_strings, kFilebase)
| 475,491
|
def testBigZip(self): """Verify that we can download a 1GB file.
|
def testBigZip(self): """Verify that we can download a 1GB file.
| 475,492
|
def WriteGetCode(self, file): """Overridden from Argument.""" file.Write(" %s %s;\n" % (self.type, self.name)) file.Write(" if (!id_map_.GetServiceId(c.%s, &%s)) {\n" % (self.name, self.name)) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return parse_error::kParseNoError;\n") file.Write(" }\n")
|
def WriteGetCode(self, file): """Overridden from Argument.""" file.Write(" %s %s;\n" % (self.type, self.name)) file.Write(" if (!id_manager_->GetServiceId(c.%s, &%s)) {\n" % (self.name, self.name)) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return parse_error::kParseNoError;\n") file.Write(" }\n")
| 475,493
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
|
def main(options, args): logfile = open('testserver.log', 'w') sys.stdout = FileMultiplexer(sys.stdout, logfile) sys.stderr = FileMultiplexer(sys.stderr, logfile) port = options.port if options.server_type == SERVER_HTTP: if options.cert: # let's make sure the cert file exists. if not os.path.isfile(options.cert): print 'specified server cert file not found: ' + options.cert + \ ' exiting...' return for ca_cert in options.ssl_client_ca: if not os.path.isfile(ca_cert): print 'specified trusted client CA file not found: ' + ca_cert + \ ' exiting...' return server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert, options.ssl_client_auth, options.ssl_client_ca, options.ssl_bulk_cipher) print 'HTTPS server started on port %d...' % server.server_port else: server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) print 'HTTP server started on port %d...' % server.server_port server.data_dir = MakeDataDir() server.file_root_url = options.file_root_url listen_port = server.server_port server._device_management_handler = None elif options.server_type == SERVER_SYNC: server = SyncHTTPServer(('127.0.0.1', port), SyncPageHandler) print 'Sync HTTP server started on port %d...' % server.server_port listen_port = server.server_port # means FTP Server else: my_data_dir = MakeDataDir() # Instantiate a dummy authorizer for managing 'virtual' users authorizer = pyftpdlib.ftpserver.DummyAuthorizer() # Define a new user having full r/w permissions and a read-only # anonymous user authorizer.add_user('chrome', 'chrome', my_data_dir, perm='elradfmw') authorizer.add_anonymous(my_data_dir) # Instantiate FTP handler class ftp_handler = pyftpdlib.ftpserver.FTPHandler ftp_handler.authorizer = authorizer # Define a customized banner (string returned when client connects) ftp_handler.banner = ("pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__) # Instantiate FTP server class and listen to 127.0.0.1:port address = ('127.0.0.1', port) server = pyftpdlib.ftpserver.FTPServer(address, ftp_handler) listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port # Notify the parent that we've started. (BaseServer subclasses # bind their sockets on construction.) if options.startup_pipe is not None: if sys.platform == 'win32': fd = msvcrt.open_osfhandle(options.startup_pipe, 0) else: fd = options.startup_pipe startup_pipe = os.fdopen(fd, "w") # Write the listening port as a 2 byte value. This is _not_ using # network byte ordering since the other end of the pipe is on the same # machine. startup_pipe.write(struct.pack('@H', listen_port)) startup_pipe.close() try: server.serve_forever() except KeyboardInterrupt: print 'shutting down server' server.stop = True
| 475,494
|
def Close(self): self.Write("#endif // %s\n\n" % self.guard) CWriter.Close(self)
|
def Close(self): self.Write("#endif // %s\n\n" % self.guard) CWriter.Close(self)
| 475,495
|
def WriteValidUnitTest(self, func, file, test, extra = {}): """Writes a valid unit test.""" if func.GetInfo('expectation') == False: test = self._remove_expected_call_re.sub('', test) name = func.name arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): arg_strings.append(arg.GetValidArg(count, 0)) count += 1 gl_arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): gl_arg_strings.append(arg.GetValidGLArg(count, 0)) count += 1 gl_func_name = func.GetGLTestFunctionName() vars = { 'test_name': 'GLES2DecoderTest%d' % file.file_num, 'name':name, 'gl_func_name': gl_func_name, 'args': ", ".join(arg_strings), 'gl_args': ", ".join(gl_arg_strings), } vars.update(extra) file.Write(test % vars)
|
def WriteValidUnitTest(self, func, file, test, extra = {}): """Writes a valid unit test.""" name = func.name arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): arg_strings.append(arg.GetValidArg(count, 0)) count += 1 gl_arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): gl_arg_strings.append(arg.GetValidGLArg(count, 0)) count += 1 gl_func_name = func.GetGLTestFunctionName() vars = { 'test_name': 'GLES2DecoderTest%d' % file.file_num, 'name':name, 'gl_func_name': gl_func_name, 'args': ", ".join(arg_strings), 'gl_args': ", ".join(gl_arg_strings), } vars.update(extra) file.Write(test % vars)
| 475,496
|
def WriteInvalidUnitTest(self, func, file, test, extra = {}): """Writes a invalid unit test.""" arg_index = 0 for arg in func.GetOriginalArgs(): num_invalid_values = arg.GetNumInvalidValues(func) for value_index in range(0, num_invalid_values): arg_strings = [] parse_result = "kNoError" gl_error = None count = 0 for arg in func.GetOriginalArgs(): if count == arg_index: (arg_string, parse_result, gl_error) = arg.GetInvalidArg( count, value_index) else: arg_string = arg.GetValidArg(count, 0) arg_strings.append(arg_string) count += 1 gl_arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): gl_arg_strings.append("_") count += 1 gl_func_name = func.GetGLTestFunctionName() gl_error_test = '' if not gl_error == None: gl_error_test = '\n EXPECT_EQ(%s, GetGLError());' % gl_error
|
def WriteInvalidUnitTest(self, func, file, test, extra = {}): """Writes a invalid unit test.""" arg_index = 0 for arg in func.GetOriginalArgs(): num_invalid_values = arg.GetNumInvalidValues() for value_index in range(0, num_invalid_values): arg_strings = [] parse_result = "kNoError" gl_error = None count = 0 for arg in func.GetOriginalArgs(): if count == arg_index: (arg_string, parse_result, gl_error) = arg.GetInvalidArg( count, value_index) else: arg_string = arg.GetValidArg(count, 0) arg_strings.append(arg_string) count += 1 gl_arg_strings = [] count = 0 for arg in func.GetOriginalArgs(): gl_arg_strings.append("_") count += 1 gl_func_name = func.GetGLTestFunctionName() gl_error_test = '' if not gl_error == None: gl_error_test = '\n EXPECT_EQ(%s, GetGLError());' % gl_error
| 475,497
|
def WriteGLES2ImplementationDeclaration(self, func, file): """Writes the GLES2 Implemention declaration.""" file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
|
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention declaration.""" file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
| 475,498
|
def WriteGLES2ImplementationDeclaration(self, func, file): """Writes the GLES2 Implemention declaration.""" file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
|
def WriteGLES2ImplementationDeclaration(self, func, file): """Writes the GLES2 Implemention declaration.""" file.Write("%s %s(%s);\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write("\n")
| 475,499
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.