rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
if _wdiff_available: try: wdiff = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] except ValueError, e: wdiff = '' wdiff = cgi.escape(wdiff) wdiff = wdiff.replace(' wdiff = wdiff.replace(' wdiff = wdiff.replace(' result = '<head><style>.del { background: result += '.add { background: result += '<pre>'... | return self._executive.run_command(self._wdiff_command()) | def wdiff_text(self, actual_filename, expected_filename): """Returns a string of HTML indicating the word-level diff of the contents of the two filenames. Returns an empty string if word-level diffing isn't available.""" executable = self._path_to_wdiff() cmd = [executable, '--start-delete=##WDIFF_DEL##', '--end-delete... |
if (e.errno == errno.ENOENT or e.errno == errno.EACCES or e.errno == errno.ECHILD): _wdiff_available = False else: raise e return result | _wdiff_available = False return '' except ScriptError, e: _wdiff_available = False return "" | def wdiff_text(self, actual_filename, expected_filename): """Returns a string of HTML indicating the word-level diff of the contents of the two filenames. Returns an empty string if word-level diffing isn't available.""" executable = self._path_to_wdiff() cmd = [executable, '--start-delete=##WDIFF_DEL##', '--end-delete... |
if BUILD_ARCHIVE_TYPE in ('linux', 'linux-64'): | if BUILD_ARCHIVE_TYPE in ('linux', 'linux-64', 'linux-chromiumos'): | def SetArchiveVars(archive): """Set a bunch of global variables appropriate for the specified archive.""" global BUILD_ARCHIVE_TYPE global BUILD_ARCHIVE_DIR global BUILD_ZIP_NAME global BUILD_DIR_NAME global BUILD_EXE_NAME global BUILD_BASE_URL BUILD_ARCHIVE_TYPE = archive BUILD_ARCHIVE_DIR = 'chromium-rel-' + BUILD_A... |
choices = ['mac', 'xp', 'linux', 'linux-64'] | choices = ['mac', 'xp', 'linux', 'linux-64', 'linux-chromiumos'] | def main(): usage = ('%prog [options] [-- chromium-options]\n' 'Perform binary search on the snapshot builds.') parser = optparse.OptionParser(usage=usage) # Strangely, the default help output doesn't include the choice list. choices = ['mac', 'xp', 'linux', 'linux-64'] parser.add_option('-a', '--archive', choices = ch... |
Committer("Kenneth Russell", "kbr@google.com"), | def __init__(self, name, email_or_emails, irc_nickname=None): Committer.__init__(self, name, email_or_emails, irc_nickname) self.can_review = True | |
class ForkingHTTPServer(SocketServer.ForkingMixIn, StoppableHTTPServer): """This is a specialization of of StoppableHTTPServer which serves each request in a separate process""" pass class ForkingHTTPSServer(SocketServer.ForkingMixIn, HTTPSServer): """This is a specialization of of HTTPSServer which serves each reques... | def handshake(self, tlsConnection): """Creates the SSL connection.""" try: tlsConnection.handshakeServer(certChain=self.cert_chain, privateKey=self.private_key, sessionCache=self.session_cache) tlsConnection.ignoreAbruptClose = True return True except tlslite.api.TLSError, error: print "Handshake failure:", str(error) ... | |
if options.forking: server_class = ForkingHTTPSServer else: server_class = HTTPSServer server = server_class(('127.0.0.1', port), TestPageHandler, options.cert) | server = HTTPSServer(('127.0.0.1', port), TestPageHandler, options.cert) | def main(options, args): # redirect output to a log file so it doesn't spam the unit test output logfile = open('testserver.log', 'w') sys.stderr = sys.stdout = logfile port = options.port # Try to free up the port if there's an orphaned old instance. TryKillingOldServer(port) if options.server_type == SERVER_HTTP: ... |
if options.forking: server_class = ForkingHTTPServer else: server_class = StoppableHTTPServer server = server_class(('127.0.0.1', port), TestPageHandler) | server = StoppableHTTPServer(('127.0.0.1', port), TestPageHandler) | def main(options, args): # redirect output to a log file so it doesn't spam the unit test output logfile = open('testserver.log', 'w') sys.stderr = sys.stdout = logfile port = options.port # Try to free up the port if there's an orphaned old instance. TryKillingOldServer(port) if options.server_type == SERVER_HTTP: ... |
option_parser.add_option('--forking', action='store_true', default=False, dest='forking', help='Serve each request in a separate process.') | def line_logger(msg): if (msg.find("kill") >= 0): server.stop = True print 'shutting down server' sys.exit(0) | |
Reviewer("Martin Robinson", ["mrobinson@igalia.com", "mrobinson@webkit.org", "martin.james.robinson@gmail.com"], "mrobinson"), | Reviewer("Martin Robinson", ["mrobinson@webkit.org", "mrobinson@igalia.com", "martin.james.robinson@gmail.com"], "mrobinson"), | def __init__(self, name, email_or_emails, irc_nickname=None): Committer.__init__(self, name, email_or_emails, irc_nickname) self.can_review = True |
commit_info = self.tool.checkout().commit_info_for_revision(svn_revision) self._sheriff.post_irc_warning(commit_info, builders) self._sheriff.post_blame_comment_on_bug(commit_info, builders, blame_list) self._sheriff.post_automatic_rollout_patch(commit_info, builders) for builder in builders: self.tool.status_server.u... | try: commit_info = self.tool.checkout().commit_info_for_revision(svn_revision) self._sheriff.post_irc_warning(commit_info, builders) self._sheriff.post_blame_comment_on_bug(commit_info, builders, blame_list) self._sheriff.post_automatic_rollout_patch(commit_info, builders) finally: for builder in builders: self.tool.st... | def process_work_item(self, new_failures): blame_list = new_failures.keys() for svn_revision, builders in new_failures.items(): commit_info = self.tool.checkout().commit_info_for_revision(svn_revision) self._sheriff.post_irc_warning(commit_info, builders) self._sheriff.post_blame_comment_on_bug(commit_info, builders, b... |
path = self.request.path | path = os.path.realpath(os.path.join('/', self.request.path)) | def get(self): path = self.request.path # special path to invoke the unit tests # TODO(nickbaum): is there a less ghetto way to invoke the unit test? if path == "/test/": self.unitTest() return # if root, redirect to index.html # TODO(nickbaum): this doesn't handle /chrome/extensions/trunk, etc if (path == "/chrome/ext... |
if path == "/test/": | if path == "/test": | def get(self): path = self.request.path # special path to invoke the unit tests # TODO(nickbaum): is there a less ghetto way to invoke the unit test? if path == "/test/": self.unitTest() return # if root, redirect to index.html # TODO(nickbaum): this doesn't handle /chrome/extensions/trunk, etc if (path == "/chrome/ext... |
file = codecs.open(self._pidfile, "w", "ascii") try: | with codecs.open(self._pidfile, "w", "ascii") as file: | def start(self): if not self._web_socket_tests: _log.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name) |
finally: file.close() | def start(self): if not self._web_socket_tests: _log.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name) | |
file = codecs.open(self._pidfile, "r", "ascii") try: | with codecs.open(self._pidfile, "r", "ascii") as file: | def stop(self, force=False): if not force and not self.is_running(): return |
finally: file.close() | def stop(self, force=False): if not force and not self.is_running(): return | |
def testDnsPrefectchingEnabledPref(self): | def testDnsPrefetchingEnabledPref(self): | def testDnsPrefectchingEnabledPref(self): """Verify DNS prefetching pref.""" # Assert default self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kDnsPrefetchingEnabled)) self.SetPrefs(pyauto.kDnsPrefetchingEnabled, False) self.RestartBrowser(clear_profile=False) self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kDnsPrefe... |
def run_prompt_test(options, inputs, expected_result, can_choose_multiple=False): | def run_prompt_test(inputs, expected_result, can_choose_multiple=False): | def run_prompt_test(options, inputs, expected_result, can_choose_multiple=False): def mock_raw_input(message): return inputs.pop(0) self.assertEqual(User.prompt_with_list("title", options, can_choose_multiple=can_choose_multiple, raw_input=mock_raw_input), expected_result) self.assertEqual(len(inputs), 0) |
self.assertEqual(User.prompt_with_list("title", options, can_choose_multiple=can_choose_multiple, raw_input=mock_raw_input), expected_result) | output_capture = OutputCapture() actual_result = output_capture.assert_outputs( self, User.prompt_with_list, args=["title", ["foo", "bar"]], kwargs={"can_choose_multiple": can_choose_multiple, "raw_input": mock_raw_input}, expected_stdout="title\n 1. foo\n 2. bar\n") self.assertEqual(actual_result, expected_result) | def mock_raw_input(message): return inputs.pop(0) |
run_prompt_test(["foo", "bar"], ["1"], "foo") run_prompt_test(["foo", "bar"], ["badinput", "2"], "bar") | run_prompt_test(["1"], "foo") run_prompt_test(["badinput", "2"], "bar") | def mock_raw_input(message): return inputs.pop(0) |
run_prompt_test(["foo", "bar"], ["1,2"], ["foo", "bar"], can_choose_multiple=True) run_prompt_test(["foo", "bar"], [" 1, 2 "], ["foo", "bar"], can_choose_multiple=True) run_prompt_test(["foo", "bar"], ["all"], ["foo", "bar"], can_choose_multiple=True) run_prompt_test(["foo", "bar"], [""], ["foo", "bar"], can_choose... | run_prompt_test(["1,2"], ["foo", "bar"], can_choose_multiple=True) run_prompt_test([" 1, 2 "], ["foo", "bar"], can_choose_multiple=True) run_prompt_test(["all"], ["foo", "bar"], can_choose_multiple=True) run_prompt_test([""], ["foo", "bar"], can_choose_multiple=True) run_prompt_test([" "], ["foo", "bar"], can_choo... | def mock_raw_input(message): return inputs.pop(0) |
log_fmt = ('%(asctime)s %(process)d %(filename)s:%(lineno)-4d %(levelname)s' '%(message)s') | log_fmt = ('%(asctime)s %(process)d %(filename)s:%(lineno)d ' '%(levelname)s %(message)s') | def _configure_logging(stream, verbose): log_fmt = '%(message)s' log_datefmt = '%y%m%d %H:%M:%S' log_level = logging.INFO if verbose: log_fmt = ('%(asctime)s %(process)d %(filename)s:%(lineno)-4d %(levelname)s' '%(message)s') log_level = logging.DEBUG root = logging.getLogger() handler = logging.StreamHandler(stream) ... |
original_stderr = original_stderr | sys.stderr = original_stderr | def assert_log_equals(self, log_input, expected_output): original_stderr = sys.stderr test_stderr = StringIO.StringIO() sys.stderr = test_stderr |
def _GetTestsFromName(name): | def _ImportTestsFromName(name): | def _GetTestsFromName(name): """Get a list of all test names from the given string. |
map(self._GetTestsFromName, all_tests_modules)) | map(self._ImportTestsFromName, all_tests_modules)) | def _ListMissingTests(self): """Print tests missing from PYAUTO_TESTS.""" # Fetch tests from all test scripts all_test_files = filter(lambda x: x.endswith('.py'), os.listdir(self.TestsDir())) all_tests_modules = [os.path.splitext(x)[0] for x in all_test_files] all_tests = reduce(lambda x, y: x + y, map(self._GetTestsFr... |
map(self._GetTestsFromName, self._LoadTestNamesFrom(pyauto_tests_file))) | map(self._ImportTestsFromName, self._ExpandTestNamesFrom(pyauto_tests_file, self._options.suite))) | def _ListMissingTests(self): """Print tests missing from PYAUTO_TESTS.""" # Fetch tests from all test scripts all_test_files = filter(lambda x: x.endswith('.py'), os.listdir(self.TestsDir())) all_tests_modules = [os.path.splitext(x)[0] for x in all_test_files] all_tests = reduce(lambda x, y: x + y, map(self._GetTestsFr... |
def _LoadTests(self, args): """Returns a suite of tests loaded from the given args. | def _ExpandTestNames(self, args): """Returns a list of tests loaded from the given args. | def _LoadTests(self, args): """Returns a suite of tests loaded from the given args. |
args = self._LoadTestNamesFrom(pyauto_tests_file) args = args * self._options.repeat logging.debug("Loading %d tests from %s", len(args), args) loaded_tests = unittest.defaultTestLoader.loadTestsFromNames(args) return loaded_tests def _LoadTestNamesFrom(self, filename): modules= PyUITest.EvalDataFrom(filename) | args = self._ExpandTestNamesFrom(pyauto_tests_file, self._options.suite) return args def _ExpandTestNamesFrom(self, filename, suite): """Load test names from the given file. Args: filename: the file to read the tests from suite: the name of the suite to load from |filename|. Returns: a list of test names [module.tes... | def _LoadTests(self, args): """Returns a suite of tests loaded from the given args. |
all_names = modules.get('all', []) + \ modules.get(self._platform_map[platform], []) | def _NamesInSuite(suite_name): logging.debug('Expanding suite %s' % suite_name) platforms = suites.get(suite_name) names = platforms.get('all', []) + \ platforms.get(self._platform_map[platform], []) ret = [] for name in names: if name.startswith('@'): ret.extend(_NamesInSuite(name[1:])) else: ret.append(name) return ... | def _LoadTestNamesFrom(self, filename): modules= PyUITest.EvalDataFrom(filename) platform = sys.platform if PyUITest.IsChromeOS(): # check if it's chromeos platform = 'chromeos' assert platform in self._platform_map, '%s unsupported' % platform all_names = modules.get('all', []) + \ modules.get(self._platform_map[plat... |
excluded.extend(self._GetTestsFromName(name[1:])) | excluded.extend(self._ImportTestsFromName(name[1:])) | def _LoadTestNamesFrom(self, filename): modules= PyUITest.EvalDataFrom(filename) platform = sys.platform if PyUITest.IsChromeOS(): # check if it's chromeos platform = 'chromeos' assert platform in self._platform_map, '%s unsupported' % platform all_names = modules.get('all', []) + \ modules.get(self._platform_map[plat... |
args.extend(self._GetTestsFromName(name)) | args.extend(self._ImportTestsFromName(name)) | def _LoadTestNamesFrom(self, filename): modules= PyUITest.EvalDataFrom(filename) platform = sys.platform if PyUITest.IsChromeOS(): # check if it's chromeos platform = 'chromeos' assert platform in self._platform_map, '%s unsupported' % platform all_names = modules.get('all', []) + \ modules.get(self._platform_map[plat... |
loaded_tests = self._LoadTests(self._args) | test_names = self._ExpandTestNames(self._args) test_names *= self._options.repeat logging.debug("Loading %d tests from %s", len(test_names), test_names) if self._options.list_tests: for name in test_names: print name sys.exit(0) loaded_tests = unittest.defaultTestLoader.loadTestsFromNames(test_names) | def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid()) |
"--timeout=120000", | "--timeout=180000", | def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=120000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=120000", "--ui-test-action-timeout=80000", "--ui-test-action-max-timeout=180000", "--ui-test-terminate-timeout=60000"]) |
"--ui-test-timeout=120000", "--ui-test-action-timeout=80000", | "--ui-test-timeout=180000", "--ui-test-action-timeout=120000", | def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=120000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=120000", "--ui-test-action-timeout=80000", "--ui-test-action-max-timeout=180000", "--ui-test-terminate-timeout=60000"]) |
"--ui-test-terminate-timeout=60000"]) | "--ui-test-terminate-timeout=120000"]) | def TestUI(self): return self.SimpleTest("chrome", "ui_tests", valgrind_test_args=[ "--timeout=120000", "--trace_children", "--indirect"], cmd_args=[ "--ui-test-timeout=120000", "--ui-test-action-timeout=80000", "--ui-test-action-max-timeout=180000", "--ui-test-terminate-timeout=60000"]) |
paths.insert(0, self._webkit_baseline_path(self._name)) | paths.insert(0, self._webkit_baseline_path( 'google-chrome-linux32')) | def baseline_search_path(self): paths = chromium_linux.ChromiumLinuxPort.baseline_search_path( self) paths.insert(0, self._webkit_baseline_path(self._name)) return paths |
return GoogleChromeLinux32Port(port_name, options) | return GoogleChromeLinux32Port(None, options) | def baseline_search_path(self): paths = chromium_linux.ChromiumLinuxPort.baseline_search_path( self) paths.insert(0, self._webkit_baseline_path(self._name)) return paths |
paths.insert(0, self._webkit_baseline_path(self._name)) | paths.insert(0, self._webkit_baseline_path( 'google-chrome-linux64')) | def baseline_search_path(self): paths = chromium_linux.ChromiumLinuxPort.baseline_search_path( self) paths.insert(0, self._webkit_baseline_path(self._name)) return paths |
return GoogleChromeLinux64Port(port_name, options) | return GoogleChromeLinux64Port(None, options) | def baseline_search_path(self): paths = chromium_linux.ChromiumLinuxPort.baseline_search_path( self) paths.insert(0, self._webkit_baseline_path(self._name)) return paths |
return GoogleChromeMacPort(port_name, options) | return GoogleChromeMacPort(None, options) | def baseline_search_path(self): paths = chromium_mac.ChromiumMacPort.baseline_search_path( self) paths.insert(0, self._webkit_baseline_path( 'google-chrome-mac')) return paths |
return GoogleChromeWinPort(port_name, options) | return GoogleChromeWinPort(None, options) | def baseline_search_path(self): paths = chromium_win.ChromiumWinPort.baseline_search_path( self) paths.insert(0, self._webkit_baseline_path( 'google-chrome-win')) return paths |
self._source_dir = os.path.abspath(self._source_dir).replace('\\', '/') | self._source_dir = layout_package.path_utils.get_absolute_path( self._source_dir) | 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.TestG... |
script = os.path.join(self._source_dir, "third_party", "WebKit", "WebKitTools", "Scripts", "run-chromium-webkit-tests") | script = os.path.join(self._source_dir, "webkit", "tools", "layout_tests", "run_webkit_tests.py") | def TestLayoutChunk(self, chunk_num, chunk_size): # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the # list of tests. Wrap around to beginning of list at end. # If chunk_size is zero, run all tests in the list once. # If a text file is given as argument, it is used as the list of tests. # # Build ... |
if self._errors: logging.error("FAIL! There were %s errors: " % len(self._errors)) | if cur_report_errors: logging.error("FAIL! There were %s errors: " % len(cur_report_errors)) | def Report(self, files, check_sanity=False): '''Reads in a set of files and prints Memcheck report. |
return valgrind_test.RunTool(cmd) | return valgrind_test.RunTool(cmd, "layout") | def TestLayoutChunk(self, chunk_num, chunk_size): # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the # list of tests. Wrap around to beginning of list at end. # If chunk_size is zero, run all tests in the list once. # If a text file is given as argument, it is used as the list of tests. # # Build ... |
f_orig = self._get_iterable_expectations() | f_orig = self._get_iterable_expectations(self._expectations) | def remove_platform_from_expectations(self, tests, platform): """Returns a copy of the expectations with the tests matching the platform remove. |
'http://a.nonexisting.domain.blah', 'ftp://this.should.not.exist/file', | self.GetFileURLForPath('another_non-existing_path'), | def testInvalidURLNoHistory(self): """Invalid URLs should not go in history.""" assert not self.GetHistoryInfo().History(), 'Expecting clean history.' urls = [ self.GetFileURLForPath('some_non-existing_path'), 'http://a.nonexisting.domain.blah', 'ftp://this.should.not.exist/file', ] for url in urls: self.NavigateToURL(... |
self.NavigateToURL(url) | if not url.startswith('file://'): logging.warn('Using %s. Might depend on how dns failures are handled' 'on the network' % url) self.NavigateToURL(url) | def testInvalidURLNoHistory(self): """Invalid URLs should not go in history.""" assert not self.GetHistoryInfo().History(), 'Expecting clean history.' urls = [ self.GetFileURLForPath('some_non-existing_path'), 'http://a.nonexisting.domain.blah', 'ftp://this.should.not.exist/file', ] for url in urls: self.NavigateToURL(... |
if name == 'BufferData' or name == 'BufferSubData': | if name == 'BufferData': | 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 == 'CompressedTexImag... |
elif (name == 'CompressedTexImage2D' or name == 'CompressedTexSubImage2D'): | elif name == 'BufferSubData': file.Write(" uint32 data_size = size;\n") elif name == 'CompressedTexImage2D': | 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 == 'CompressedTexImag... |
elif name == 'TexImage2D' or name == 'TexSubImage2D': code = """ uint32 data_size; if (!GLES2Util::ComputeImageDataSize( width, height, format, type, unpack_alignment_, &data_size)) { return error::kOutOfBounds; } """ file.Write(code) | elif name == 'CompressedTexSubImage2D': file.Write(" uint32 data_size = imageSize;\n") elif name == 'TexImage2D': file.Write(" uint32 data_size = GLES2Util::ComputeImageDataSize(\n") file.Write(" width, height, format, type, unpack_alignment_);\n") elif name == 'TexSubImage2D': file.Write(" uint32 data_size = G... | 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 == 'CompressedTexImag... |
code = """ uint32 data_size; if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { return error::kOutOfBounds; } """ file.Write(code) | file.Write(" uint32 data_size = n * sizeof(GLuint);\n") | def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size; |
code = """ %(last_arg_type)s params; GLsizei num_values = util_.GLGetNumValuesReturned(pname); uint32 params_size; if (!SafeMultiplyUint32(num_values, sizeof(*params), ¶ms_size)) { return error::kOutOfBounds; } params = GetSharedMemoryAs<%(last_arg_type)s>( c.params_shm_id, c.params_shm_offset, params_size); """ fi... | file.Write(" %s params;\n" % last_arg.type) file.Write(" GLsizei num_values = util_.GLGetNumValuesReturned(pname);\n") file.Write(" uint32 params_size = num_values * sizeof(*params);\n") file.Write(" params = GetSharedMemoryAs<%s>(\n" % last_arg.type) file.Write(" c.params_shm_id, c.params_shm_offset, params_s... | 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() |
code = """ uint32 data_size; if (!ComputeDataSize(1, sizeof(%s), %d, &data_size)) { return error::kOutOfBounds; } """ file.Write(code % (func.info.data_type, func.info.count)) if func.is_immediate: file.Write(" if (data_size > immediate_data_size) {\n") file.Write(" return error::kOutOfBounds;\n") file.Write(" }\... | file.Write(" uint32 data_size = ComputeImmediateDataSize(" "immediate_data_size, 1, sizeof(%s), %d);\n" % (func.info.data_type, func.info.count)) | def WriteGetDataSizeCode(self, func, file): """Overrriden from TypeHandler.""" code = """ uint32 data_size; |
if (bufsize > 0) { std::string str; if (GetBucketAsString(kResultBucketId, &str)) { GLsizei max_size = std::min(static_cast<size_t>(%(bufsize_name)s) - 1, str.size()); if (%(length_name)s != NULL) { *%(length_name)s = max_size; } memcpy(%(dest_name)s, str.c_str(), max_size); %(dest_name)s[max_size] = '\\0'; | std::string str; if (GetBucketAsString(kResultBucketId, &str)) { GLsizei max_size = std::min(static_cast<size_t>(%(bufsize_name)s) - 1, str.size()); if (%(length_name)s != NULL) { *%(length_name)s = max_size; | def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(func_name)s(%(args)s) { |
except IOError: _log.debug("Server NOT running at %s" % url) | except IOError, e: _log.debug("Server NOT running at %s: %s" % (url, e)) | def is_server_running_on_all_ports(self): """Returns whether the server is running on all the desired ports.""" for mapping in self.mappings: if 'sslcert' in mapping: http_suffix = 's' else: http_suffix = '' |
stack_line = re.compile('\s*@\s*(?:0x)?[0-9a-fA-F]*\s*(\S*)') | stack_line = re.compile('\s*@\s*(?:0x)?[0-9a-fA-F]*\s*([^\n]*)') | def Analyze(self, log_lines, check_sanity=False): """Analyzes the app's output and applies suppressions to the reports. |
log("Bugzilla login failed: %s" % match.group(1)) | errorMessage = "Bugzilla login failed: %s" % match.group(1) if attempts < 5: log(errorMessage) else: raise Exception(errorMessage) | def authenticate(self): if self.authenticated: return |
test_dir = os.path.abspath('.') file_path = os.path.join(test_dir, 'downloads.py') | file_path = self._GetDangerousDownload() | def testDownloadDangerousFiles(self): """Verify that we can download and save dangerous files.""" test_dir = os.path.abspath('.') # This file is a .py file which is "dangerous" file_path = os.path.join(test_dir, 'downloads.py') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadD... |
'downloads.py') | os.path.basename(file_path)) | def testDownloadDangerousFiles(self): """Verify that we can download and save dangerous files.""" test_dir = os.path.abspath('.') # This file is a .py file which is "dangerous" file_path = os.path.join(test_dir, 'downloads.py') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadD... |
PermanentItem('google_chrome_extensions', name='Extensions', parent_tag='google_chrome', sync_type=EXTENSIONS), PermanentItem('google_chrome_passwords', name='Passwords', parent_tag='google_chrome', sync_type=PASSWORD), | def __init__(self, tag, name, parent_tag, sync_type): self.tag = tag self.name = name self.parent_tag = parent_tag self.sync_type = sync_type | |
self.NO_SUCH_URL2 = 'http://no_such_url_exists2/' self.NO_SUCH_URL3 = 'http://no_such_url_exists3/' | def __init__(self, methodName='runTest'): super(NotificationsTest, self).__init__(methodName) self.NO_SUCH_URL = 'http://no_such_url_exists/' self.NO_SUCH_URL2 = 'http://no_such_url_exists2/' self.NO_SUCH_URL3 = 'http://no_such_url_exists3/' # Content settings for default notification permission. self.ALLOW_ALL_SETTING... | |
self._CreateHTMLNotification(self.NO_SUCH_URL) self._CreateHTMLNotification(self.NO_SUCH_URL2) self._CreateHTMLNotification(self.NO_SUCH_URL3) | self._CreateSimpleNotification('', 'Title1', '') self._CreateSimpleNotification('', 'Title2', '') self._CreateSimpleNotification('', 'Title3', '') | def testNotificationOrderAfterClosingOne(self): """Tests that closing a notification leaves the rest of the notifications in the correct order. """ self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL) self._CreateHTMLNotification(self.NO_SUCH_URL2) self._CreateHT... |
notifications = self.GetActiveNotifications() self.assertEquals(self.NO_SUCH_URL, notifications[0]['content_url']) self.assertEquals(self.NO_SUCH_URL3, notifications[1]['content_url']) | new_notifications = self.GetActiveNotifications() self.assertEquals(old_notifications[0], new_notifications[0]) self.assertEquals(old_notifications[2], new_notifications[1]) | def testNotificationOrderAfterClosingOne(self): """Tests that closing a notification leaves the rest of the notifications in the correct order. """ self._AllowAllOrigins() self.NavigateToURL(self.TEST_PAGE_URL) self._CreateHTMLNotification(self.NO_SUCH_URL) self._CreateHTMLNotification(self.NO_SUCH_URL2) self._CreateHT... |
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, ... | if ':' in test: (self._test, self._gtest_filter) = test.split(':', 1) else: self._test = test self._gtest_filter = options.gtest_filter if self._test not in self._test_list: | 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.TestG... |
self._test = test | 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.TestG... | |
return self._test_list[self._test]() | return self._test_list[self._test](self) | def Run(self): ''' Runs the test specified by command-line argument --test ''' logging.info("running test %s" % (self._test)) return self._test_list[self._test]() |
gtest_filter = self._options.gtest_filter | gtest_filter = self._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-%... |
parser.add_option("-t", "--test", action="append", help="which test to run") | parser.add_option("-t", "--test", action="append", default=[], help="which test to run, supports test:gtest_filter format " "as well.") | def _main(_): parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " "[-t <test> ...]") parser.disable_interspersed_args() parser.add_option("-b", "--build_dir", help="the location of the output of the compiler output") parser.add_option("-t", "--test", action="append", help="which test to run") parser.add_o... |
if not options.test or not len(options.test): | if not options.test: | def _main(_): parser = optparse.OptionParser("usage: %prog -b <dir> -t <test> " "[-t <test> ...]") parser.disable_interspersed_args() parser.add_option("-b", "--build_dir", help="the location of the output of the compiler output") parser.add_option("-t", "--test", action="append", help="which test to run") parser.add_o... |
for dir in ['BackMenu_', 'ForwardMenu_']: | for dir in ('BackMenu_', 'ForwardMenu_'): | def AddComputedActions(actions): """Add computed actions to the actions list. Arguments: actions: set of actions to add to. """ # Actions for back_forward_menu_model.cc. for dir in ['BackMenu_', 'ForwardMenu_']: actions.add(dir + 'ShowFullHistory') actions.add(dir + 'Popup') for i in range(1, 20): actions.add(dir + '... |
if os.path.exists(deps_file): | if os.path.isfile(deps_file): | 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) |
if results_json[self.VERSION_KEY] == 2: | if self.VERSION_KEY in results_json and results_json[self.VERSION_KEY] == 2: | def _ConvertJSONToCurrentVersion(self, results_json): """If the JSON does not match the current version, converts it to the current version and adds in the new version number. """ if (self.VERSION_KEY in results_json and results_json[self.VERSION_KEY] == self.VERSION): return |
logging.debug('Starting %s server.' % self._server_name) | logging.info('Starting %s server on %d.' % ( self._server_name, self._port)) logging.debug('cmdline: %s' % ' '.join(start_cmd)) | def Start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.IsRunning(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name) |
logging.debug('Shutting down %s server %d.' % (self._server_name, pid)) | logging.info('Shutting down %s server %d.' % (self._server_name, pid)) | def Stop(self, force=False): if not force and not self.IsRunning(): return |
["BUG1234 MAC : passes/text.html = PASS FAIL"], | ["BUGCR1234 MAC : passes/text.html = PASS FAIL"], | def test_valid_expectations(self): self.assert_lines_lint( ["passes/text.html = PASS"], "") self.assert_lines_lint( ["passes/text.html = FAIL PASS"], "") self.assert_lines_lint( ["passes/text.html = CRASH TIMEOUT FAIL PASS"], "") self.assert_lines_lint( ["BUG1234 MAC : passes/text.html = PASS FAIL"], "") self.assert_li... |
["SKIP BUG1234 : passes/text.html = TIMEOUT PASS"], | ["SKIP BUGCR1234 : passes/text.html = TIMEOUT PASS"], | def test_valid_expectations(self): self.assert_lines_lint( ["passes/text.html = PASS"], "") self.assert_lines_lint( ["passes/text.html = FAIL PASS"], "") self.assert_lines_lint( ["passes/text.html = CRASH TIMEOUT FAIL PASS"], "") self.assert_lines_lint( ["BUG1234 MAC : passes/text.html = PASS FAIL"], "") self.assert_li... |
["BUG1234 DEBUG : passes/text.html = TIMEOUT PASS"], | ["BUGCR1234 DEBUG : passes/text.html = TIMEOUT PASS"], | def test_valid_expectations(self): self.assert_lines_lint( ["passes/text.html = PASS"], "") self.assert_lines_lint( ["passes/text.html = FAIL PASS"], "") self.assert_lines_lint( ["passes/text.html = CRASH TIMEOUT FAIL PASS"], "") self.assert_lines_lint( ["BUG1234 MAC : passes/text.html = PASS FAIL"], "") self.assert_li... |
["BUG1234 DEBUG SKIP : passes/text.html = TIMEOUT PASS"], | ["BUGCR1234 DEBUG SKIP : passes/text.html = TIMEOUT PASS"], | def test_valid_expectations(self): self.assert_lines_lint( ["passes/text.html = PASS"], "") self.assert_lines_lint( ["passes/text.html = FAIL PASS"], "") self.assert_lines_lint( ["passes/text.html = CRASH TIMEOUT FAIL PASS"], "") self.assert_lines_lint( ["BUG1234 MAC : passes/text.html = PASS FAIL"], "") self.assert_li... |
["BUG1234 MAC DEBUG SKIP : passes/text.html = TIMEOUT PASS"], | ["BUGCR1234 MAC DEBUG SKIP : passes/text.html = TIMEOUT PASS"], | def test_valid_expectations(self): self.assert_lines_lint( ["passes/text.html = PASS"], "") self.assert_lines_lint( ["passes/text.html = FAIL PASS"], "") self.assert_lines_lint( ["passes/text.html = CRASH TIMEOUT FAIL PASS"], "") self.assert_lines_lint( ["BUG1234 MAC : passes/text.html = PASS FAIL"], "") self.assert_li... |
["BUG1234 DEBUG MAC : passes/text.html = TIMEOUT PASS"], | ["BUGCR1234 DEBUG MAC : passes/text.html = TIMEOUT PASS"], | def test_valid_expectations(self): self.assert_lines_lint( ["passes/text.html = PASS"], "") self.assert_lines_lint( ["passes/text.html = FAIL PASS"], "") self.assert_lines_lint( ["passes/text.html = CRASH TIMEOUT FAIL PASS"], "") self.assert_lines_lint( ["BUG1234 MAC : passes/text.html = PASS FAIL"], "") self.assert_li... |
["SLOW BUG1234 : passes/text.html = PASS"], | ["SLOW BUGCR1234 : passes/text.html = PASS"], | def test_valid_expectations(self): self.assert_lines_lint( ["passes/text.html = PASS"], "") self.assert_lines_lint( ["passes/text.html = FAIL PASS"], "") self.assert_lines_lint( ["passes/text.html = CRASH TIMEOUT FAIL PASS"], "") self.assert_lines_lint( ["BUG1234 MAC : passes/text.html = PASS FAIL"], "") self.assert_li... |
server_data = { 'port': listen_port } server_data_json = simplejson.dumps(server_data) debug('sending server_data: %s' % server_data_json) | 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): pr... | |
locals = {'Var': lambda _: ''} | locals = {'Var': lambda _: locals["vars"][_]} | def GetWebKitRev(): """Extract the 'webkit_revision' variable out of DEPS.""" locals = {'Var': lambda _: ''} execfile('DEPS', {}, locals) return locals['vars']['webkit_revision'] |
os.path.abspath(__file__)))))), 'thirdparty', 'pywebsocket') | os.path.abspath(__file__)))), 'thirdparty', 'pywebsocket') | def start(self): if not self._web_socket_tests: logging.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name) |
return '%s_main.scons' % GypBuilder.base_name | return '%s.Makefile' % GypBuilder.base_name | def GetSolutionPath(self): """Gets the solution path.""" return '%s_main.scons' % GypBuilder.base_name |
solution = self.GetSolutionPath() self.Execute(['hammer', '-f', solution, '--clean']) | print "clean not implemented for this platform." | def CleanTargets(self, targets, options): """Cleans the targets.""" solution = self.GetSolutionPath() self.Execute(['hammer', '-f', solution, '--clean']) |
self.Execute(['hammer', '-f', solution]) | self.Execute(['make', '-f', solution]) | def Dobuild(self, targets, options): """Builds the specifed targets.""" solution = self.GetSolutionPath() self.Execute(['hammer', '-f', solution]) |
def _win32_check_running_pid(self): | def _win32_check_running_pid(self, pid): | def _win32_check_running_pid(self): |
return self._win32_check_running_pid() | return self._win32_check_running_pid(pid) | def check_running_pid(self, pid): """Return True if pid is alive, otherwise return False.""" if sys.platform in ('darwin', 'linux2', 'cygwin'): try: os.kill(pid, 0) return True except OSError: return False elif sys.platform == 'win32': return self._win32_check_running_pid() |
vsprops_directory = os.path.join(os.environ['WEBKITLIBRARIESDIR'], 'tools', 'vsprops') | top_level_directory = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) vsprops_directory = os.path.join(top_level_directory, 'WebKitLibraries', 'win', 'tools', 'vsprops') | def main(): vsprops_directory = os.path.join(os.environ['WEBKITLIBRARIESDIR'], 'tools', 'vsprops') newest_vsprops_time = max(file_modification_times(vsprops_directory)) obj_directory = os.path.join(os.environ['WEBKITOUTPUTDIR'], 'obj') for manifest_file in glob.iglob(os.path.join(obj_directory, '*', '*', '*.manifest*'... |
self.assertEqual(chrome_overrides, chromium_overrides + expected_string) | if chromium_overrides: self.assertEqual(chrome_overrides, chromium_overrides + expected_string) else: self.assertEqual(chrome_overrides, expected_string) | def mock_open(path, mode, encoding): if 'test_expectations_chrome.txt' in path: return base_unittest.NewStringIO(expected_string) return orig_open(path, mode, encoding) |
print 'HTTPS server started on port %d...' % server.server_port | print 'HTTPS server started on port %d...' % port | 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): pr... |
print 'HTTP server started on port %d...' % server.server_port | print 'HTTP server started on port %d...' % port | 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): pr... |
listen_port = server.server_port | 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): pr... | |
listen_port = server.socket.getsockname()[1] print 'FTP server started on port %d...' % listen_port | print 'FTP server started on port %d...' % port | 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): pr... |
startup_pipe.write(struct.pack('@H', listen_port)) | startup_pipe.write("READY") | 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): pr... |
option_parser.add_option('', '--port', default='0', type='int', help='Port used by the server. If unspecified, the ' 'server will listen on an ephemeral port.') | option_parser.add_option('', '--port', default='8888', type='int', help='Port used by the server.') | 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): pr... |
return urllib2.urlopen(update_status_url).read() | return urllib2.urlopen(url).read() | def _fetch_url(self, url): try: return urllib2.urlopen(update_status_url).read() except urllib2.HTTPError, e: if e.code == 404: return None raise e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.