rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
def WriteValidationCode(self, file):
def WriteValidationCode(self, file, func):
def WriteValidationCode(self, file): """Overridden from Argument.""" file.Write(" if (%s == NULL) {\n" % self.name) file.Write(" return error::kOutOfBounds;\n") file.Write(" }\n")
arg.WriteValidationCode(file)
arg.WriteValidationCode(file, self)
def WriteHandlerValidation(self, file): """Writes validation code for the function.""" for arg in self.GetOriginalArgs(): arg.WriteValidationCode(file) self.WriteValidationCode(file)
self.WaitForInfobarCount(0)
def testNoTranslate(self): """Tests that a page isn't translated if the user declines translate.""" self._NavigateAndWaitForBar(self._GetDefaultSpanishURL()) self.SelectTranslateOption('decline_translation') self.WaitForInfobarCount(0) translate_info = self.GetTranslateInfo() self.assertEqual(self.spanish, translate_in...
def Execute(self): super(ThreadSanitizerWindows, self).Execute() return 0
def Analyze(self, check_sanity=False): filenames = glob.glob(self.temp_dir + "/tsan.*") analyzer = tsan_analyze.TsanAnalyzer(self._source_dir) ret = analyzer.Report(filenames, check_sanity) if ret != 0: logging.info(self.INFO_MESSAGE) return ret
def __init__(self, httpd_port, results_directory):
def __init__(self, httpd_port, results_directory, results_json):
def __init__(self, httpd_port, results_directory): BaseHTTPServer.HTTPServer.__init__(self, ("", httpd_port), RebaselineHTTPRequestHandler) self.results_directory = results_directory
results_directory=results_directory)
results_directory=results_directory, results_json=results_json)
def execute(self, options, args, tool): results_directory = args[0]
except pythoncom.com_error, e: print 'Exception from solution.DTE "%s", retrying: ' % str(e) time.sleep(2.0)
except pythoncom.com_error: logging.exception('Exception getting DTE, retrying') time.sleep(10.0)
def _GetDte(self, solution): '''Sometimes invoking solution.DTE will fail with an exception during Visual Studio initialization. To work around this, we try a couple of times with an intervening sleep to give VS time to settle.''' # Attempt ten times under a try block. for i in range(0, 10): try: return solution.DTE ex...
print 'Building project "%s" in "%s" configuration' % (project, config)
logging.info('Building project "%s" in "%s" configuration', project, config)
def BuildConfig(self, config): '''Builds all projects for a given config.
runner = TestRunner(_CHROME_SOLUTION, _PROJECTS_TO_BUILD, _TESTS_TO_RUN)
parser = GetOptionParser() (options, args) = parser.parse_args() if args: parser.error('This script takes no arguments') solution = options.solution if not os.path.exists(solution): solution = os.path.join(os.path.dirname(_CHROME_SOLUTION), solution) solution = solution + '.sln' solution = os.path.abspath(solutio...
def Main(): if not ctypes.windll.shell32.IsUserAnAdmin(): print ("Please run the smoke tests in an admin prompt " "(or AppVerifier won't work).") return 1 runner = TestRunner(_CHROME_SOLUTION, _PROJECTS_TO_BUILD, _TESTS_TO_RUN) failures = 0 for config in _CONFIGURATIONS: failures += runner.BuildConfig(config) if fai...
file.Write(" if (!id_map_.GetServiceId(c.%s, &%s)) {\n" %
file.Write(" if (!id_manager_->GetServiceId(c.%s, &%s)) {\n" %
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")
MAX_NUMBER_OF_BUILD_RESULTS_TO_LOG = 750
MAX_NUMBER_OF_BUILD_RESULTS_TO_LOG = 1500
def fixable(self): return self.failed or self.skipped
return ' && '.join(map(wrapWithEnable, conditional))
return ' '.join(map(wrapWithEnable, conditional))
def wrapWithEnable(s): return 'ENABLE(' + s + ')'
conditional = conditional.split('&')
conditional = re.split('([|&])', conditional)
def extractConditional(idlFilePath): conditional = None # Read file and look for "interface [ Conditional=XXX ]". idlFile = open(idlFilePath) idlContents = idlFile.read().replace('\n', '') idlFile.close() match = conditionalPattern.search(idlContents) if match: conditional = match.group(1) conditional = conditional.s...
tombstone = sync_pb2.SyncEntity() tombstone.id_string = entry.id_string tombstone.deleted = True tombstone.name = '' entry = tombstone
def MakeTombstone(id_string): """Make a tombstone entry that will replace the entry being deleted. Args: id_string: Index of the SyncEntity to be deleted. Returns: A new SyncEntity reflecting the fact that the entry is deleted. """ tombstone = sync_pb2.SyncEntity() tombstone.id_string = id_string tombstone.deleted...
def CommitEntry(self, entry, cache_guid, commit_session): """Attempt to commit one entry to the user's account.
return self._port.diff_image(output1, output2)
return self._port.diff_image(output1, output2, None, 0)
def _diff_baselines(self, output1, output2, is_image): """Check whether two baselines are different.
black_list = input_api.DEFAULT_BLACK_LIST + EXCLUDED_PATHS
black_list = input_api.DEFAULT_BLACK_LIST + _EXCLUDED_PATHS white_list = input_api.DEFAULT_WHITE_LIST + _TEXT_FILES
def _CommonChecks(input_api, output_api): results = [] # What does this code do? # It loads the default black list (e.g. third_party, experimental, etc) and # add our black list (breakpad, skia and v8 are still not following # google style and are not really living this repository). # See presubmit_support.py InputApi....
input_api, output_api, sources))
input_api, output_api, text_files))
def _CommonChecks(input_api, output_api): results = [] # What does this code do? # It loads the default black list (e.g. third_party, experimental, etc) and # add our black list (breakpad, skia and v8 are still not following # google style and are not really living this repository). # See presubmit_support.py InputApi....
self.item_ids = self.item_dates = []
self.item_ids = [] self.item_dates = []
def _set_item_time_pairs(self, pairs): if pairs: # The * operator raises on an empty list. # db.Model does not tuples, we have to make lists. self.item_ids, self.item_dates = map(list, zip(*pairs)) else: self.item_ids = self.item_dates = []
if sys.platform in ('cygwin', 'win32'):
if sys.platform is 'win32':
def filename_to_uri(self, filename): """Convert a test file to a URI.""" LAYOUTTEST_HTTP_DIR = "http/tests/" LAYOUTTEST_WEBSOCKET_DIR = "websocket/tests/"
with codecs.open(path, "w", encoding=encoding) as file:
write_mode = "w" if encoding is None: write_mode = "wb" with codecs.open(path, write_mode, encoding=encoding) as file:
def update_baseline(self, path, data, encoding): """Updates the baseline for a test.
return MacPort
return Mock()
def port(self): # FIXME: Consider using a mock here. return MacPort
commit_queue_url = "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=commit-queue%2B"
commit_queue_url = "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=commit-queue%2B&order=Last+Changed"
def fetch_bug_ids_from_commit_queue(self): commit_queue_url = "buglist.cgi?query_format=advanced&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=commit-queue%2B" return self._fetch_bug_ids_advanced_query(commit_queue_url)
self._save_baseline_data(filename, output, ".txt", encoding=None,
self._save_baseline_data(filename, actual_test_output.text, ".txt", encoding=None,
def compare_output(self, port, filename, test_args, actual_test_output, expected_test_output): """Implementation of CompareOutput that checks the output text against the expected text from the LayoutTest directory.""" failures = []
return file(expectations_file, "r").read()
return file(overrides_file, "r").read()
def test_expectations_overrides(self): overrides_file = self.path_from_chromium_base('webkit', 'tools', 'layout_tests', 'test_expectations.txt') if os.path.exists(overrides_file): return file(expectations_file, "r").read() else: return None
failure_map.add_regression_window(builder, regression_window)
if regression_window: failure_map.add_regression_window(builder, regression_window)
def failure_map(self, only_core_builders=True): builder_statuses = self.core_builder_statuses() if only_core_builders else self.builder_statuses() failure_map = FailureMap() revision_to_failing_bots = {} for builder_status in builder_statuses: if builder_status["is_green"]: continue builder = self.builder_with_name(bui...
exit(main())
sys.exit(main())
def main(): cmd = [sys.executable] src_dir=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(os.path.abspath(sys.argv[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 '...
if (%(id)s != 0) { %(lc_type)s_id_allocator_.MarkAsUsed(%(id)s); }
%(lc_type)s_id_handler_->MarkAsUsedForBind(%(id)s);
def WriteGLES2ImplementationHeader(self, func, file): """Writes the GLES2 Implemention.""" impl_func = func.GetInfo('impl_func') impl_decl = func.GetInfo('impl_decl') if (func.can_auto_generate and (impl_func == None or impl_func == True) and (impl_decl == None or impl_decl == True)): file.Write("%s %s(%s) {\n" % (func...
MakeIds(&%(resource_type)s_id_allocator_, %(args)s);
%(resource_type)s_id_handler_->MakeIds(0, %(args)s);
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(name)s(%(typed_args)s) {
file.Write(" MakeIds(&program_and_shader_id_allocator_, 1, &client_id);\n")
file.Write(" program_and_shader_id_handler_->MakeIds(0, 1, &client_id);\n")
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" GLuint client_id;\n") file.Write(" MakeIds(&program_and_shader_id_allocator_, 1, &client_id);\n") file.Write("...
file.Write(" FreeIds(&%s_id_allocator_, %s);\n" %
file.Write(" %s_id_handler_->FreeIds(%s);\n" %
def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: file.Write("%s %s(%s) {\n" % (func.return_type, func.original_name, func.MakeTypedOriginalArgString(""))) file.Write(" FreeIds(&%s_id_allocator_, %s)...
'win': '_pyautolib.dll',
'win': '_pyautolib.pyd',
def _ParseArgs(self): parser = optparse.OptionParser() parser.add_option( '-d', '--outdir', type='string', default=None, help='Directory in which to setup. This is typically the directory ' 'where the binaries would go when compiled from source.') parser.add_option( '-p', '--platform', type='string', default=pyauto_uti...
'win': '_pyautolib.dll'
'win': '_pyautolib.pyd'
def Run(self): self._ParseArgs() if not os.path.isdir(self._outdir): os.makedirs(self._outdir)
impl_func = func.GetInfo('ImplFunc')
impl_func = func.GetInfo('impl_func')
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(""))) fi...
'Chromium Mac (valgrind)', 'Chromium Mac UI (valgrind)(1)', 'Chromium Mac UI (valgrind)(2)', 'Chromium Mac UI (valgrind)(3)', 'Chromium Mac (tsan)', 'Webkit Mac (valgrind)',
'Chromium Arm (dbg)',
def CheckChangeOnCommit(input_api, output_api): results = [] 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'. ...
'Linux Tests (valgrind)(1)', 'Linux Tests (valgrind)(2)', 'Linux Tests (valgrind)(3)', 'Linux Tests (valgrind)(4)', 'Webkit Linux (valgrind layout)',
def CheckChangeOnCommit(input_api, output_api): results = [] 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'. ...
help_text = "Land the current diff via the commit-queue (Experimental)"
help_text = "Land the current diff via the commit-queue"
def _prepare_state(self, options, args, tool): state = {} state["bug_id"] = self._bug_id(options, args, tool, state) if not state["bug_id"]: error("No bug id passed and no bug url found in ChangeLogs.") return state
chrome_flags += ' --dom-automation'
def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid())
from pyautolib import PyUITestSuite
from pyautolib import *
def _LocateBinDirs(): script_dir = os.path.dirname(__file__) chrome_src = os.path.join(script_dir, os.pardir, os.pardir, os.pardir) bin_dirs = { 'linux2': [ os.path.join(chrome_src, 'out', 'Debug'), os.path.join(chrome_src, 'sconsbuild', 'Debug'), os.path.join(chrome_src, 'out', 'Release'), os.path.join(chrome_src, 's...
Committer("Mike Belshe", "mike@belshe.com"),
Committer("Mike Belshe", ["mbelshe@chromium.org", "mike@belshe.com"]),
def __init__(self, name, email_or_emails): Committer.__init__(self, name, email_or_emails) self.can_review = True
builder['is_green'] = not re.search('fail', cell.renderContents()) or \ re.search('lost', cell.renderContents())
builder['is_green'] = not re.search('fail', cell.renderContents())
def _parse_last_build_cell(self, builder, cell): status_link = cell.find('a') if status_link: # Will be either a revision number or a build number revision_string = status_link.string # If revision_string has non-digits assume it's not a revision number. builder['built_revision'] = int(revision_string) \ if not re.matc...
test_file = test_file[index + 1:]
test_file = test_file[index + len('LayoutTests/'):]
def _GetDirForTestFile(self, test_file): """Returns the highest-level directory by which to shard the given test file.""" # TODO(ojan): See if we can grab the lowest level directory. That will # provide better parallelization. We should at least be able to do so # for some directories (e.g. LayoutTests/dom). index = te...
"""Print timing info by directory
"""Print timing info by directory for any directories that take > 10 seconds to run.
def _PrintDirectoryTimings(self, write, directory_test_timings): """Print timing info by directory
write("Time to process each subdirectory:")
write("Time to process slowest subdirectories:") min_seconds_to_print = 10
def _PrintDirectoryTimings(self, write, directory_test_timings): """Print timing info by directory
write(" %s took %s seconds to run %s tests." % (timing[1], timing[0], timing[2]))
if timing[0] > min_seconds_to_print: write(" %s took %s seconds to run %s tests." % (timing[1], timing[0], timing[2]))
def _PrintDirectoryTimings(self, write, directory_test_timings): """Print timing info by directory
except:
except SQLExecutionError:
def testDeleteNonexistentRow(self): """Attempts to delete a nonexistent row in the table.""" self.NavigateToURL(self.TEST_PAGE_URL) self._CreateTable() self._InsertRecord('text') did_throw_exception = False try: self._DeleteRecord(1) except: did_throw_exception = True self.assertTrue(did_throw_exception) self.assertEqu...
can_read_regular_database = False try: if len(self._GetRecords(windex=1)) == 1: can_read_regular_database = True except SQLExecutionError: pass self.assertFalse(can_read_regular_database) self._CreateTable(windex=1) self.assertEqual(0, len(self._GetRecords(windex=1)))
self.assertFalse(self._HasTable(windex=1)) self._CreateTable(windex=1) self.assertFalse(self._GetRecords(windex=1))
def testIncognitoCannotReadRegularDatabase(self): """Attempt to read a database created in a regular browser from an incognito browser. """ self.NavigateToURL(self.TEST_PAGE_URL) self._CreateTable() self._InsertRecord('text') self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) self.NavigateToURL(self.TEST_PAGE_URL, 1, 0) ...
can_read_incognito_database = False try: if len(self._GetRecords()) == 1: can_read_incognito_database = True except SQLExecutionError: pass self.assertFalse(can_read_incognito_database)
self.assertFalse(self._HasTable()) self._CreateTable() self.assertFalse(self._GetRecords())
def testRegularCannotReadIncognitoDatabase(self): """Attempt to read a database created in an incognito browser from a regular browser. """ self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) self.NavigateToURL(self.TEST_PAGE_URL, 1, 0) self._CreateTable(windex=1) self._InsertRecord('text', windex=1)
self._update_status("Unable to successfully build and test", results_file=failure_log)
self._update_status("Unable to successfully do a clean build and test", results_file=failure_log)
def _can_build_and_test(self): try: self.run_webkit_patch([ "build-and-test", "--force-clean", "--build", "--test", "--non-interactive", "--no-update", "--build-style=both", "--quiet"]) except ScriptError, e: failure_log = self._log_from_script_error_for_upload(e) self._update_status("Unable to successfully build and t...
self.run_webkit_patch(["build-and-test", "--force-clean", "--non-interactive", "--build-style=both", "--quiet"])
self.run_webkit_patch([ "build-and-test", "--force-clean", "--non-interactive", "--no-update", "--build-style=both", "--quiet"])
def _can_build_and_test(self): try: self.run_webkit_patch(["build-and-test", "--force-clean", "--non-interactive", "--build-style=both", "--quiet"]) except ScriptError, e: self._update_status("Unable to successfully build and test", None) return False return True
if not self._can_build_and_test(): return False if not self._builders_are_green(): return False
def should_proceed_with_work_item(self, patch): if not patch.is_rollout(): if not self._builders_are_green(): return False if not self._can_build_and_test(): return False if not self._builders_are_green(): return False self._update_status("Landing patch", patch) return True
def process_work_item(self, patch):
def _land(self, patch, first_run=False):
def process_work_item(self, patch): try: self._cc_watchers(patch.bug_id()) args = [ "land-attachment", "--force-clean", "--non-interactive", "--parent-command=commit-queue", "--build-style=both", "--quiet", patch.id() ] if patch.is_rollout(): # We need to ignore the builders when landing a rollout # because they're pro...
self._cc_watchers(patch.bug_id())
def process_work_item(self, patch): try: self._cc_watchers(patch.bug_id()) args = [ "land-attachment", "--force-clean", "--non-interactive", "--parent-command=commit-queue", "--build-style=both", "--quiet", patch.id() ] if patch.is_rollout(): # We need to ignore the builders when landing a rollout # because they're pro...
"--parent-command=commit-queue",
def process_work_item(self, patch): try: self._cc_watchers(patch.bug_id()) args = [ "land-attachment", "--force-clean", "--non-interactive", "--parent-command=commit-queue", "--build-style=both", "--quiet", patch.id() ] if patch.is_rollout(): # We need to ignore the builders when landing a rollout # because they're pro...
else: args.append("--no-update")
def process_work_item(self, patch): try: self._cc_watchers(patch.bug_id()) args = [ "land-attachment", "--force-clean", "--non-interactive", "--parent-command=commit-queue", "--build-style=both", "--quiet", patch.id() ] if patch.is_rollout(): # We need to ignore the builders when landing a rollout # because they're pro...
if not p == platform: new_options += p.upper() + ' '
p = p.upper(); if not p in (platform.upper(), 'WIN-VISTA', 'WIN-7'): new_options += p + ' '
def RemovePlatformFromFile(self, tests, platform, backup=False): """Remove the platform option from test expectations file.
class StringPrinter:
class StringPrinter(object):
def ustring_to_string(ptr, length=None): """Convert a pointer to UTF-16 data into a Python Unicode string. ptr and length are both gdb.Value objects. If length is unspecified, will guess at the length.""" extra = '' if length is None: # Try to guess at the length. for i in xrange(0, 2048): if int((ptr + i).dereference...
class TestPageHandler(BaseHTTPServer.BaseHTTPRequestHandler):
class SyncHTTPServer(StoppableHTTPServer): """An HTTP server that handles sync commands.""" def __init__(self, server_address, request_handler_class): import chromiumsync self._sync_handler = chromiumsync.TestServer() StoppableHTTPServer.__init__(self, server_address, request_handler_class) def HandleCommand(self, ...
def handshake(self, tlsConnection): """Creates the SSL connection.""" try: tlsConnection.handshakeServer(certChain=self.cert_chain, privateKey=self.private_key, sessionCache=self.session_cache, reqCert=self.ssl_client_auth, settings=self.ssl_handshake_settings, reqCAs=self.ssl_client_cas) tlsConnection.ignoreAbruptClos...
self._connect_handlers = [
connect_handlers = [
def __init__(self, request, client_address, socket_server): self._connect_handlers = [ self.RedirectConnectHandler, self.ServerAuthConnectHandler, self.DefaultConnectResponseHandler] self._get_handlers = [ self.NoCacheMaxAgeTimeHandler, self.NoCacheTimeHandler, self.CacheTimeHandler, self.CacheExpiresHandler, self.Cach...
self._get_handlers = [
get_handlers = [
def __init__(self, request, client_address, socket_server): self._connect_handlers = [ self.RedirectConnectHandler, self.ServerAuthConnectHandler, self.DefaultConnectResponseHandler] self._get_handlers = [ self.NoCacheMaxAgeTimeHandler, self.NoCacheTimeHandler, self.CacheTimeHandler, self.CacheExpiresHandler, self.Cach...
self.ChromiumSyncTimeHandler,
def __init__(self, request, client_address, socket_server): self._connect_handlers = [ self.RedirectConnectHandler, self.ServerAuthConnectHandler, self.DefaultConnectResponseHandler] self._get_handlers = [ self.NoCacheMaxAgeTimeHandler, self.NoCacheTimeHandler, self.CacheTimeHandler, self.CacheExpiresHandler, self.Cach...
self._post_handlers = [
post_handlers = [
def __init__(self, request, client_address, socket_server): self._connect_handlers = [ self.RedirectConnectHandler, self.ServerAuthConnectHandler, self.DefaultConnectResponseHandler] self._get_handlers = [ self.NoCacheMaxAgeTimeHandler, self.NoCacheTimeHandler, self.CacheTimeHandler, self.CacheExpiresHandler, self.Cach...
self.ChromiumSyncCommandHandler,
def __init__(self, request, client_address, socket_server): self._connect_handlers = [ self.RedirectConnectHandler, self.ServerAuthConnectHandler, self.DefaultConnectResponseHandler] self._get_handlers = [ self.NoCacheMaxAgeTimeHandler, self.NoCacheTimeHandler, self.CacheTimeHandler, self.CacheExpiresHandler, self.Cach...
self.DeviceManagementHandler] + self._get_handlers self._put_handlers = [
self.DeviceManagementHandler] + get_handlers put_handlers = [
def __init__(self, request, client_address, socket_server): self._connect_handlers = [ self.RedirectConnectHandler, self.ServerAuthConnectHandler, self.DefaultConnectResponseHandler] self._get_handlers = [ self.NoCacheMaxAgeTimeHandler, self.NoCacheTimeHandler, self.CacheTimeHandler, self.CacheExpiresHandler, self.Cach...
self.EchoHandler] + self._get_handlers
self.EchoHandler] + get_handlers
def __init__(self, request, client_address, socket_server): self._connect_handlers = [ self.RedirectConnectHandler, self.ServerAuthConnectHandler, self.DefaultConnectResponseHandler] self._get_handlers = [ self.NoCacheMaxAgeTimeHandler, self.NoCacheTimeHandler, self.CacheTimeHandler, self.CacheExpiresHandler, self.Cach...
BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, request, client_address, socket_server) def log_request(self, *args, **kwargs): pass def _ShouldHandleRequest(self, handler_name): """Determines if the path can be handled by the handler. We consider a handler valid if the path begins with the handler name. It ca...
BasePageHandler.__init__(self, request, client_address, socket_server, connect_handlers, get_handlers, post_handlers, put_handlers)
def __init__(self, request, client_address, socket_server): self._connect_handlers = [ self.RedirectConnectHandler, self.ServerAuthConnectHandler, self.DefaultConnectResponseHandler] self._get_handlers = [ self.NoCacheMaxAgeTimeHandler, self.NoCacheTimeHandler, self.CacheTimeHandler, self.CacheExpiresHandler, self.Cach...
if not self.server._sync_handler: import chromiumsync self.server._sync_handler = chromiumsync.TestServer() http_response, raw_reply = self.server._sync_handler.HandleCommand(
http_response, raw_reply = self.server.HandleCommand(
def ChromiumSyncCommandHandler(self): """Handle a chromiumsync command arriving via http.
def MultipartHandler(self): """Send a multipart response (10 text/html pages).""" test_name = "/multipart" if not self._ShouldHandleRequest(test_name): return False num_frames = 10 bound = '12345' self.send_response(200) self.send_header('Content-type', 'multipart/x-mixed-replace;boundary=' + bound) self.end_headers()...
def MultipartHandler(self): """Send a multipart response (10 text/html pages).""" test_name = "/multipart" if not self._ShouldHandleRequest(test_name): return False
server._sync_handler = None
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...
help='FTP or HTTP server: default is HTTP.')
help='start up an FTP server.') option_parser.add_option('', '--sync', action='store_const', const=SERVER_SYNC, default=SERVER_HTTP, dest='server_type', help='start up a sync 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...
self._cached_build_root = executive.run_command(["webkit-build-directory", "--base"]).rstrip()
self._cached_build_root = executive.run_command(["webkit-build-directory", "--top-level"]).rstrip()
def _build_path(self, *comps): if not self._cached_build_root: self._cached_build_root = executive.run_command(["webkit-build-directory", "--base"]).rstrip() return os.path.join(self._cached_build_root, self._options.target, *comps)
search_term = split_url.path partial_url = self._GetOmniboxMatchesFor(search_term, windex=windex)
partial_url = self._GetOmniboxMatchesFor(split_url.scheme, windex=windex)
def _CheckBookmarkResultForVariousInputs(self, url, title, windex=0): """Check if we get the Bookmark for complete and partial inputs.""" # Check if the complete URL would get the bookmark url_matches = self._GetOmniboxMatchesFor(url, windex=windex) self._VerifyHasBookmarkResult(url_matches) # Check if the complete tit...
if error_lines: error_eof = error_lines.pop() assert(error_eof == "
if error_lines and error_lines[-1] == " error_lines.pop()
def run_test(self, uri, timeoutms, image_hash): if uri.startswith("file:///"): command = uri[7:] else: command = uri
uri.tolower() != actual_uri.tolower()):
uri.lower() != actual_uri.lower()):
def run_test(self, uri, timeoutms, checksum): output = [] error = [] crash = False timeout = False actual_uri = None actual_checksum = None
urllib2.urlopen(request, timeout=60)
urllib2.urlopen(request)
def _upload_files(self, attrs, file_objs): url = "http://%s/testfile/upload" % self._host content_type, data = _encode_multipart_form_data(attrs, file_objs) headers = {"Content-Type": content_type} request = urllib2.Request(url, data, headers) urllib2.urlopen(request, timeout=60)
class HeaderTest(MessagesTest): def test_base_class(self): """Base classes for message structs should match expectations""" for index, message in enumerate(self.receiver.messages): self.assertEquals(messages.base_class(message), _expected_results['messages'][index]['base_class']) if message.reply_parameters != None: se...
_expected_header = """/* * Copyright (C) 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this lis...
def test_receiver(self): """Receiver should be parsed as expected""" self.assertEquals(self.receiver.name, _expected_results['name']) self.assertEquals(self.receiver.condition, _expected_results['condition']) self.assertEquals(len(self.receiver.messages), len(_expected_results['messages'])) for index, message in enumer...
p = subprocess.Popen(['git', 'log', '-1'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=(sys.platform=='win32'))
proc = subprocess.Popen(['git', 'log', '-999'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=(sys.platform=='win32')) for line in proc.stdout: match = git_re.search(line) if match: id = match.group(2) if id: proc.stdout.close() return id
def git_fetch_id(): """ Fetch the GIT identifier for the local tree. Errors are swallowed. """ try: p = subprocess.Popen(['git', 'log', '-1'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=(sys.platform=='win32')) except OSError: # 'git' is apparently either not installed or not executable. return None id = No...
return None id = None if p: git_re = re.compile('^\s*git-svn-id:\s+(\S+)@(\d+)', re.M) m = git_re.search(p.stdout.read()) if m: id = m.group(2) return id
pass return None
def git_fetch_id(): """ Fetch the GIT identifier for the local tree. Errors are swallowed. """ try: p = subprocess.Popen(['git', 'log', '-1'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=(sys.platform=='win32')) except OSError: # 'git' is apparently either not installed or not executable. return None id = No...
if not os.path.exists(os.path.join(dir_name, ".svn")):
if not (os.path.exists(os.path.join(dir_name, ".svn")) or (dir_name in GIT_SOURCE_DIRECTORY)):
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 di...
if self.attrs['use_name_for_id'] == 'true':
if (self.attrs['use_name_for_id'] == 'true' and self.SatisfiesOutputCondition()):
def EndParsing(self): super(type(self), self).EndParsing()
rcode = subprocess.call(['wdiff'], stderr=f)
rcode = 0 try: rcode = subprocess.call(['wdiff'], stderr=f) except OSError: logging.warning('wdiff not found. Install using MacPorts or some ' 'other means') pass
def _check_wdiff_install(self): f = open(os.devnull, 'w') rcode = subprocess.call(['wdiff'], stderr=f) f.close() if rcode == 127: logging.error('wdiff not found. Install using MacPorts or some ' 'other means') return False return True
if rcode == 127: logging.error('wdiff not found. Install using MacPorts or some ' 'other means') return False
def _check_wdiff_install(self): f = open(os.devnull, 'w') rcode = subprocess.call(['wdiff'], stderr=f) f.close() if rcode == 127: logging.error('wdiff not found. Install using MacPorts or some ' 'other means') return False return True
f.write(command)
f.write(command.replace("%p", "$$.%p"))
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ ...
logs_list = logfiles.replace("%p", "*")
logs_list = logfiles.replace("%p", "$$.*")
def CreateBrowserWrapper(self, command, logfiles): """The program being run invokes Python or something else that can't stand to be valgrinded, and also invokes the Chrome browser. Set an environment variable to tell the program to prefix the Chrome commandline with a magic wrapper. Build the magic wrapper here. """ ...
raise (exception_info[0], exception_info[1], exception_info[2])
raise exception_info[0], exception_info[1], exception_info[2]
def _wait_for_threads_to_finish(self, threads, result_summary): keyboard_interrupted = False try: # Loop through all the threads waiting for them to finish. some_thread_is_alive = True while some_thread_is_alive: some_thread_is_alive = False t = time.time() for thread in threads: exception_info = thread.exception_info(...
self._create_bug_for_flaky_test(flaky_test, latest_flake_message)
self._create_bug_for_flaky_test(flaky_test, author_emails, latest_flake_message)
def report_flaky_tests(self, flaky_tests, patch): message = "The %s encountered the following flaky tests while processing attachment %s:\n\n" % (self._bot_name, patch.id()) for flaky_test in flaky_tests: bug = self._lookup_bug_for_flaky_test(flaky_test) latest_flake_message = "The %s just saw %s flake while processing...
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]):
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[], expect_retval=None):
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
Waits until the |function| evalues to True or until |timeout| secs, whichever occurs earlier.
Waits until the |function| evalues to |expect_retval| or until |timeout| secs, whichever occurs earlier.
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
if function(*args):
retval = function(*args) if (expect_retval is None and retval) or expect_retval == retval:
def WaitUntil(self, function, timeout=-1, retry_sleep=0.25, args=[]): """Poll on a condition until timeout.
cmd_dict = { 'command': 'WaitForInfobarCount', 'count': count, 'tab_index': tab_index, }
def WaitForInfobarCount(self, count, windex=0, tab_index=0): """Wait until infobar count becomes |count|.
return self.WaitUntil( lambda(count): len(self.GetBrowserInfo()\ ['windows'][windex]['tabs'][tab_index]['infobars']) == count, args=[count])
def _InfobarCount(): windows = self.GetBrowserInfo()['windows'] if windex >= len(windows): return -1 tabs = windows[windex]['tabs'] if tab_index >= len(tabs): return -1 return len(tabs[tab_index]['infobars']) return self.WaitUntil(_InfobarCount, expect_retval=count)
def WaitForInfobarCount(self, count, windex=0, tab_index=0): """Wait until infobar count becomes |count|.
self._irc = IRCProxy()
self._irc = IRCProxy(password=self._irc_password)
def ensure_irc_connected(self): if not self._irc: self._irc = IRCProxy()
self.ImportSettings('Mozilla Firefox', False, ['ALL'])
self.ImportSettings('Mozilla Firefox', False, self._to_import)
def testFirefoxImportFromPrefs(self): """Verify importing Firefox data through preferences.""" self._SwapFirefoxProfile() self.ImportSettings('Mozilla Firefox', False, ['ALL']) self._CheckDefaults(bookmarks=True, history=True, passwords=True, home_page=False, search_engines=True)
self.ImportSettings('Mozilla Firefox', True, ['ALL'])
self.ImportSettings('Mozilla Firefox', True, self._to_import)
def testFirefoxFirstRun(self): """Verify importing from Firefox on the first run.
self.ImportSettings('Mozilla Firefox', False, ['ALL'])
self.ImportSettings('Mozilla Firefox', False, self._to_import)
def testImportFirefoxDataTwice(self): """Verify importing Firefox data twice.
self.ImportSettings('Mozilla Firefox', False, ['ALL']) self.ImportSettings('Safari', False, ['ALL'])
self.ImportSettings('Mozilla Firefox', False, self._to_import) self.ImportSettings('Safari', False, self._to_import)
def testImportFromFirefoxAndSafari(self): """Verify importing from Firefox and then Safari.""" # This test is for Mac only. if not self.IsMac(): return
self.ImportSettings('Safari', False, ['ALL'])
self.ImportSettings('Safari', False, self._to_import)
def testSafariImportFromPrefs(self): """Verify importing Safari data through preferences.""" # This test is Mac only. if not self.IsMac(): return self._SwapSafariProfile() self.ImportSettings('Safari', False, ['ALL']) self._CheckDefaults(bookmarks=True, history=True, passwords=False, home_page=False, search_engines=Tru...
self.ImportSettings('Safari', False, ['ALL'])
self.ImportSettings('Safari', False, self._to_import)
def testSafariFirstRun(self): """Verify importing Safari data on the first run.""" # This test is Mac only. if not self.IsMac(): return self._SwapSafariProfile() self.ImportSettings('Safari', False, ['ALL']) self._CheckDefaults(bookmarks=True, history=True, passwords=False, home_page=False, search_engines=False)
self.ImportSettings('Safari', False, ['ALL'])
self.ImportSettings('Safari', False, self._to_import)
def testImportSafariDataTwice(self): """Verify importing Safari data twice.
if not file: return None
def ReadFile(filename): try: file = open(filename, 'r') except IOError, e: print >> sys.stderr, ('I/O Error reading file %s(%s): %s' % (filename, e.errno, e.strerror)) raise e if not file: return None contents = file.read() file.close() return contents
continue if line == '{': skip_next_line = True
def CheckChange(input_api, output_api): """Checks the memcheck suppressions files for bad data.""" errors = [] skip_next_line = False func_re = input_api.re.compile('[a-z_.]+\(.+\)$') for f, line_num, line in input_api.RightHandSideLines(lambda x: x.LocalPath().endswith('.txt')): line = line.lstrip() if line.startswith...