bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
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 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
475,700
def __init__(self, options): self._options = options
def __init__(self, options): self._options = options
475,701
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/extensions") or (path == "chrome/extensions/"): self.redirect("/chrome/extensions/index.html") return # else remove prefix if(path[:18] == "/chrome/extensions"): path = path[18:] # TODO(nickbaum): there's a subtle bug here: if there are two instances of the app, # their default caches will override each other. This is bad! result = memcache.get(path) if result is None: logging.info("Cache miss: " + path) url = self.getSrcUrl(path) if (url[1] is not Channel.TRUNK) and (url[0] != "http://src.chromium.org/favicon.ico"): branch = self.getBranch(url[1]) url = url[0] % branch else: url = url[0] logging.info("Path: " + self.request.path) logging.info("Url: " + url) try: result = urlfetch.fetch(url + self.request.query_string) if result.status_code != 200: logging.error("urlfetch failed: " + url) # TODO(nickbaum): what should we do when the urlfetch fails? except: logging.error("urlfetch failed: " + url) # TODO(nickbaum): what should we do when the urlfetch fails? try: if not memcache.add(path, result, DEFAULT_CACHE_TIME): logging.error("Memcache set failed.") except: logging.error("Memcache set failed.") for key in result.headers: self.response.headers[key] = result.headers[key] self.response.out.write(result.content)
def get(self): path = os.path.realpath(os.path.join('/', 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/extensions") or (path == "chrome/extensions/"): self.redirect("/chrome/extensions/index.html") return # else remove prefix if(path[:18] == "/chrome/extensions"): path = path[18:] # TODO(nickbaum): there's a subtle bug here: if there are two instances of the app, # their default caches will override each other. This is bad! result = memcache.get(path) if result is None: logging.info("Cache miss: " + path) url = self.getSrcUrl(path) if (url[1] is not Channel.TRUNK) and (url[0] != "http://src.chromium.org/favicon.ico"): branch = self.getBranch(url[1]) url = url[0] % branch else: url = url[0] logging.info("Path: " + self.request.path) logging.info("Url: " + url) try: result = urlfetch.fetch(url + self.request.query_string) if result.status_code != 200: logging.error("urlfetch failed: " + url) # TODO(nickbaum): what should we do when the urlfetch fails? except: logging.error("urlfetch failed: " + url) # TODO(nickbaum): what should we do when the urlfetch fails? try: if not memcache.add(path, result, DEFAULT_CACHE_TIME): logging.error("Memcache set failed.") except: logging.error("Memcache set failed.") for key in result.headers: self.response.headers[key] = result.headers[key] self.response.out.write(result.content)
475,702
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/extensions") or (path == "chrome/extensions/"): self.redirect("/chrome/extensions/index.html") return # else remove prefix if(path[:18] == "/chrome/extensions"): path = path[18:] # TODO(nickbaum): there's a subtle bug here: if there are two instances of the app, # their default caches will override each other. This is bad! result = memcache.get(path) if result is None: logging.info("Cache miss: " + path) url = self.getSrcUrl(path) if (url[1] is not Channel.TRUNK) and (url[0] != "http://src.chromium.org/favicon.ico"): branch = self.getBranch(url[1]) url = url[0] % branch else: url = url[0] logging.info("Path: " + self.request.path) logging.info("Url: " + url) try: result = urlfetch.fetch(url + self.request.query_string) if result.status_code != 200: logging.error("urlfetch failed: " + url) # TODO(nickbaum): what should we do when the urlfetch fails? except: logging.error("urlfetch failed: " + url) # TODO(nickbaum): what should we do when the urlfetch fails? try: if not memcache.add(path, result, DEFAULT_CACHE_TIME): logging.error("Memcache set failed.") except: logging.error("Memcache set failed.") for key in result.headers: self.response.headers[key] = result.headers[key] self.response.out.write(result.content)
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/extensions") or (path == "chrome/extensions/"): self.redirect("/chrome/extensions/index.html") return # else remove prefix if(path[:18] == "/chrome/extensions"): path = path[18:] # TODO(nickbaum): there's a subtle bug here: if there are two instances of the app, # their default caches will override each other. This is bad! result = memcache.get(path) if result is None: logging.info("Cache miss: " + path) url = self.getSrcUrl(path) if (url[1] is not Channel.TRUNK) and (url[0] != "http://src.chromium.org/favicon.ico"): branch = self.getBranch(url[1]) url = url[0] % branch else: url = url[0] logging.info("Path: " + self.request.path) logging.info("Url: " + url) try: result = urlfetch.fetch(url + self.request.query_string) if result.status_code != 200: logging.error("urlfetch failed: " + url) # TODO(nickbaum): what should we do when the urlfetch fails? except: logging.error("urlfetch failed: " + url) # TODO(nickbaum): what should we do when the urlfetch fails? try: if not memcache.add(path, result, DEFAULT_CACHE_TIME): logging.error("Memcache set failed.") except: logging.error("Memcache set failed.") for key in result.headers: self.response.headers[key] = result.headers[key] self.response.out.write(result.content)
475,703
def testRedirectHistory(self): """HTTP meta-refresh redirects should have separate history entries.""" assert not self.GetHistoryInfo().History(), 'Expecting clean history.' test_dir = os.path.join(os.path.abspath(self.DataDir()), 'history') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'redirector.html')) landing_url = self.GetFileURLForPath(os.path.join(test_dir, 'landing.html')) tab = self.GetBrowserWindow(0).GetTab(0) tab.NavigateToURLBlockUntilNavigationsComplete(pyauto.GURL(file_url), 2) self.assertEqual(landing_url, self.GetActiveTabURL().spec()) # We should have two history items history = self.GetHistoryInfo().History() self.assertEqual(2, len(history)) self.assertEqual(landing_url, history[0]['url'])
def testRedirectHistory(self): """HTTP meta-refresh redirects should have separate history entries.""" assert not self.GetHistoryInfo().History(), 'Expecting clean history.' test_dir = os.path.join(os.path.abspath(self.DataDir()), 'History') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'redirector.html')) landing_url = self.GetFileURLForPath(os.path.join(test_dir, 'landing.html')) tab = self.GetBrowserWindow(0).GetTab(0) tab.NavigateToURLBlockUntilNavigationsComplete(pyauto.GURL(file_url), 2) self.assertEqual(landing_url, self.GetActiveTabURL().spec()) # We should have two history items history = self.GetHistoryInfo().History() self.assertEqual(2, len(history)) self.assertEqual(landing_url, history[0]['url'])
475,704
def __init__(self, request, client_address, socket_server): connect_handlers = [ self.RedirectConnectHandler, self.ServerAuthConnectHandler, self.DefaultConnectResponseHandler] get_handlers = [ self.NoCacheMaxAgeTimeHandler, self.NoCacheTimeHandler, self.CacheTimeHandler, self.CacheExpiresHandler, self.CacheProxyRevalidateHandler, self.CachePrivateHandler, self.CachePublicHandler, self.CacheSMaxAgeHandler, self.CacheMustRevalidateHandler, self.CacheMustRevalidateMaxAgeHandler, self.CacheNoStoreHandler, self.CacheNoStoreMaxAgeHandler, self.CacheNoTransformHandler, self.DownloadHandler, self.DownloadFinishHandler, self.EchoHeader, self.EchoHeaderOverride, self.EchoAllHandler, self.FileHandler, self.RealFileWithCommonHeaderHandler, self.RealBZ2FileWithCommonHeaderHandler, self.SetCookieHandler, self.AuthBasicHandler, self.AuthDigestHandler, self.SlowServerHandler, self.ContentTypeHandler, self.ServerRedirectHandler, self.ClientRedirectHandler, self.MultipartHandler, self.DefaultResponseHandler] post_handlers = [ self.EchoTitleHandler, self.EchoAllHandler, self.EchoHandler, self.DeviceManagementHandler] + get_handlers put_handlers = [ self.EchoTitleHandler, self.EchoAllHandler, self.EchoHandler] + get_handlers
def __init__(self, request, client_address, socket_server): connect_handlers = [ self.RedirectConnectHandler, self.ServerAuthConnectHandler, self.DefaultConnectResponseHandler] get_handlers = [ self.NoCacheMaxAgeTimeHandler, self.NoCacheTimeHandler, self.CacheTimeHandler, self.CacheExpiresHandler, self.CacheProxyRevalidateHandler, self.CachePrivateHandler, self.CachePublicHandler, self.CacheSMaxAgeHandler, self.CacheMustRevalidateHandler, self.CacheMustRevalidateMaxAgeHandler, self.CacheNoStoreHandler, self.CacheNoStoreMaxAgeHandler, self.CacheNoTransformHandler, self.DownloadHandler, self.DownloadFinishHandler, self.EchoHeader, self.EchoHeaderOverride, self.EchoAllHandler, self.FileHandler, self.RealFileWithCommonHeaderHandler, self.RealBZ2FileWithCommonHeaderHandler, self.SetCookieHandler, self.AuthBasicHandler, self.AuthDigestHandler, self.SlowServerHandler, self.ContentTypeHandler, self.ServerRedirectHandler, self.ClientRedirectHandler, self.MultipartHandler, self.DefaultResponseHandler] post_handlers = [ self.EchoTitleHandler, self.EchoAllHandler, self.EchoHandler, self.DeviceManagementHandler] + get_handlers put_handlers = [ self.EchoTitleHandler, self.EchoAllHandler, self.EchoHandler] + get_handlers
475,705
def GenerateLcovPosix(self): """Convert profile data to lcov on Mac or Linux.""" start_dir = os.getcwd() if self.IsLinux(): # With Linux/make (e.g. the coverage_run target), the current # directory for this command is .../build/src/chrome but we need # to be in .../build/src for the relative path of source files # to be correct. However, when run from buildbot, the current # directory is .../build. Accommodate. # On Mac source files are compiled with abs paths so this isn't # a problem. # This is a bit of a hack. The best answer is to require this # script be run in a specific directory for all cases (from # Makefile or from buildbot). if start_dir.endswith('chrome'): print 'coverage_posix.py: doing a "cd .." to accomodate Linux/make PWD' os.chdir('..') if start_dir.endswith('build'): print 'coverage_posix.py: doing a "cd src" to accomodate buildbot PWD' os.chdir('src')
def GenerateLcovPosix(self): """Convert profile data to lcov on Mac or Linux.""" start_dir = os.getcwd() if self.IsLinux(): # With Linux/make (e.g. the coverage_run target), the current # directory for this command is .../build/src/chrome but we need # to be in .../build/src for the relative path of source files # to be correct. However, when run from buildbot, the current # directory is .../build. Accommodate. # On Mac source files are compiled with abs paths so this isn't # a problem. # This is a bit of a hack. The best answer is to require this # script be run in a specific directory for all cases (from # Makefile or from buildbot). if start_dir.endswith('chrome'): print 'coverage_posix.py: doing a "cd .." to accomodate Linux/make PWD' os.chdir('..') if start_dir.endswith('build'): print 'coverage_posix.py: doing a "cd src" to accomodate buildbot PWD' os.chdir('src')
475,706
def __init__(self, filename, file_comment = None): CWriter.__init__(self, filename)
def__init__(self,filename,file_comment=None):CWriter.__init__(self,filename)
475,707
def AssignFirstIds(self, filename_or_stream, first_id_filename): '''Assign first ids to each grouping node based on values from tools/grit/resource_ids.''' # If the input is a stream, then we're probably in a unit test and # should skip this step. if type(filename_or_stream) not in (str, unicode): return
def AssignFirstIds(self, filename_or_stream, first_id_filename): '''Assign first ids to each grouping node based on values from tools/grit/resource_ids.''' # If the input is a stream, then we're probably in a unit test and # should skip this step. if type(filename_or_stream) not in (str, unicode): return
475,708
def setup(top_dir): if 'CHROME_ORIGIN' not in os.environ.keys() or \ (os.environ['CHROME_ORIGIN'] != 'LOCAL_SOURCE' and os.environ['CHROME_ORIGIN'] != 'SERVER_SOURCE'): logging.info('Skipping Chrome test resource setup for non-local builds') return chrome_test_files = os.environ['SYSROOT'] + '/usr/local/autotest-chrome' logging.info('Configuring chrome test resources in %s' % top_dir) testsrc_dir = top_dir + '/test_src' # Copy test build outputs. utils.run('cp -ral %s %s' % (chrome_test_files, testsrc_dir))
def setup(top_dir): if 'CHROME_ORIGIN' not in os.environ.keys() or \ (os.environ['CHROME_ORIGIN'] != 'LOCAL_SOURCE' and os.environ['CHROME_ORIGIN'] != 'SERVER_SOURCE'): logging.info('Skipping Chrome test resource setup for non-local builds') return chrome_test_files = os.environ['SYSROOT'] + '/usr/local/autotest-chrome' logging.info('Configuring chrome test resources in %s' % top_dir) testsrc_dir = top_dir + '/test_src' # Copy test build outputs. utils.run('cp -ral %s %s' % (chrome_test_files, testsrc_dir))
475,709
def setup(top_dir): if 'CHROME_ORIGIN' not in os.environ.keys() or \ (os.environ['CHROME_ORIGIN'] != 'LOCAL_SOURCE' and os.environ['CHROME_ORIGIN'] != 'SERVER_SOURCE'): logging.info('Skipping Chrome test resource setup for non-local builds') return chrome_test_files = os.environ['SYSROOT'] + '/usr/local/autotest-chrome' logging.info('Configuring chrome test resources in %s' % top_dir) testsrc_dir = top_dir + '/test_src' # Copy test build outputs. utils.run('cp -ral %s %s' % (chrome_test_files, testsrc_dir))
def setup(top_dir): if 'CHROME_ORIGIN' not in os.environ.keys() or \ (os.environ['CHROME_ORIGIN'] != 'LOCAL_SOURCE' and os.environ['CHROME_ORIGIN'] != 'SERVER_SOURCE'): logging.info('Skipping Chrome test resource setup for non-local builds') return chrome_test_files = os.environ['SYSROOT'] + '/usr/local/autotest-chrome' logging.info('Configuring chrome test resources in %s' % top_dir) testsrc_dir = top_dir + '/test_src' # Copy test build outputs. utils.run('cp -ral %s %s' % (chrome_test_files, testsrc_dir))
475,710
def CallJavascriptFunc(self, function, args=[], tab_index=0, windex=0): """Executes a script which calls a given javascript function.
def CallJavascriptFunc(self, function, args=[], tab_index=0, windex=0): """Executes a script which calls a given javascript function.
475,711
def ParseDir(path): """Examine a third_party/foo component and extract its metadata.""" # Try to find README.chromium. readme_path = os.path.join(path, 'README.chromium') if not os.path.exists(readme_path): raise LicenseError("missing README.chromium") # Parse metadata fields out of README.chromium. # We provide a default value of "LICENSE" for the license file. metadata = { "License File": "LICENSE", # Relative path to license text. "Name": None, # Short name (for header on about:credits). "URL": None, # Project home page. } for line in open(readme_path): line = line.strip() for key in metadata.keys(): field = key + ": " if line.startswith(field): metadata[key] = line[len(field):] # Check that all expected metadata is present. for key, value in metadata.iteritems(): if not value: raise LicenseError("couldn't find '" + key + "' line " "in README.chromium") # Check that the license file exists. license_file = metadata["License File"] license_path = os.path.join(path, license_file) if not os.path.exists(license_path): raise LicenseError("License file '" + license_file + "' doesn't exist. " "Either add a 'License File:' section to " "README.chromium or add the missing file.") return metadata
def ParseDir(path): """Examine a third_party/foo component and extract its metadata.""" # Try to find README.chromium. readme_path = os.path.join(path, 'README.chromium') if not os.path.exists(readme_path): raise LicenseError("missing README.chromium") # Parse metadata fields out of README.chromium. # We provide a default value of "LICENSE" for the license file. metadata = { "License File": "LICENSE", # Relative path to license text. "Name": None, # Short name (for header on about:credits). "URL": None, # Project home page. } for line in open(readme_path): line = line.strip() for key in metadata.keys(): field = key + ": " if line.startswith(field): metadata[key] = line[len(field):] # Check that all expected metadata is present. for key, value in metadata.iteritems(): if not value: raise LicenseError("couldn't find '" + key + "' line " "in README.chromium") # Check that the license file exists. license_file = metadata["License File"] license_path = os.path.join(path, license_file) if not os.path.exists(license_path): raise LicenseError("License file '" + license_file + "' doesn't exist. " "Either add a 'License File:' section to " "README.chromium or add the missing file.") return metadata
475,712
def ParseDir(path): """Examine a third_party/foo component and extract its metadata.""" # Try to find README.chromium. readme_path = os.path.join(path, 'README.chromium') if not os.path.exists(readme_path): raise LicenseError("missing README.chromium") # Parse metadata fields out of README.chromium. # We provide a default value of "LICENSE" for the license file. metadata = { "License File": "LICENSE", # Relative path to license text. "Name": None, # Short name (for header on about:credits). "URL": None, # Project home page. } for line in open(readme_path): line = line.strip() for key in metadata.keys(): field = key + ": " if line.startswith(field): metadata[key] = line[len(field):] # Check that all expected metadata is present. for key, value in metadata.iteritems(): if not value: raise LicenseError("couldn't find '" + key + "' line " "in README.chromium") # Check that the license file exists. license_file = metadata["License File"] license_path = os.path.join(path, license_file) if not os.path.exists(license_path): raise LicenseError("License file '" + license_file + "' doesn't exist. " "Either add a 'License File:' section to " "README.chromium or add the missing file.") return metadata
def ParseDir(path): """Examine a third_party/foo component and extract its metadata.""" # Try to find README.chromium. readme_path = os.path.join(path, 'README.chromium') if not os.path.exists(readme_path): raise LicenseError("missing README.chromium") # Parse metadata fields out of README.chromium. # We provide a default value of "LICENSE" for the license file. metadata = { "License File": "LICENSE", # Relative path to license text. "Name": None, # Short name (for header on about:credits). "URL": None, # Project home page. } for line in open(readme_path): line = line.strip() for key in metadata.keys(): field = key + ": " if line.startswith(field): metadata[key] = line[len(field):] # Check that all expected metadata is present. for key, value in metadata.iteritems(): if not value: raise LicenseError("couldn't find '" + key + "' line " "in README.chromium") # Check that the license file exists. for filename in (metadata["License File"], "COPYING"): license_path = os.path.join(path, filename) if os.path.exists(license_path): metadata["License File"] = filename break license_path = None if not license_path: raise LicenseError("License file not found. " "Either add a file named LICENSE, " "import upstream's COPYING if available, " "or add a 'License File:' line to README.chromium " "with the appropriate path.") return metadata
475,713
def FindThirdPartyDirs(): """Find all third_party directories underneath the current directory.""" skip_dirs = ('.svn', '.git', # VCS metadata 'out', 'Debug', 'Release', # build files 'layout_tests') # lots of subdirs third_party_dirs = [] for path, dirs, files in os.walk('.'): path = path[len('./'):] # Pretty up the path. # Prune out directories we want to skip. for skip in skip_dirs: if skip in dirs: dirs.remove(skip) if os.path.basename(path) == 'third_party': third_party_dirs.extend([os.path.join(path, dir) for dir in dirs]) # Don't recurse into any subdirs from here. dirs[:] = [] continue return third_party_dirs
def FindThirdPartyDirs(): """Find all third_party directories underneath the current directory.""" skip_dirs = ('.svn', '.git', # VCS metadata 'out', 'Debug', 'Release', # build files 'layout_tests') # lots of subdirs third_party_dirs = [] for path, dirs, files in os.walk('.'): path = path[len('./'):] # Pretty up the path. # Prune out directories we want to skip. for skip in skip_dirs: if skip in dirs: dirs.remove(skip) if os.path.basename(path) == 'third_party': third_party_dirs.extend([os.path.join(path, dir) for dir in dirs]) # Don't recurse into any subdirs from here. dirs[:] = [] continue return third_party_dirs
475,714
def FindThirdPartyDirs(): """Find all third_party directories underneath the current directory.""" skip_dirs = ('.svn', '.git', # VCS metadata 'out', 'Debug', 'Release', # build files 'layout_tests') # lots of subdirs third_party_dirs = [] for path, dirs, files in os.walk('.'): path = path[len('./'):] # Pretty up the path. # Prune out directories we want to skip. for skip in skip_dirs: if skip in dirs: dirs.remove(skip) if os.path.basename(path) == 'third_party': third_party_dirs.extend([os.path.join(path, dir) for dir in dirs]) # Don't recurse into any subdirs from here. dirs[:] = [] continue return third_party_dirs
def FindThirdPartyDirs(): """Find all third_party directories underneath the current directory.""" skip_dirs = ('.svn', '.git', # VCS metadata 'out', 'Debug', 'Release', # build files 'layout_tests') # lots of subdirs third_party_dirs = [] for path, dirs, files in os.walk('.'): path = path[len('./'):] # Pretty up the path. # Prune out directories we want to skip. for skip in PRUNE_DIRS: if skip in dirs: dirs.remove(skip) if os.path.basename(path) == 'third_party': third_party_dirs.extend([os.path.join(path, dir) for dir in dirs]) # Don't recurse into any subdirs from here. dirs[:] = [] continue return third_party_dirs
475,715
def FindThirdPartyDirs(): """Find all third_party directories underneath the current directory.""" skip_dirs = ('.svn', '.git', # VCS metadata 'out', 'Debug', 'Release', # build files 'layout_tests') # lots of subdirs third_party_dirs = [] for path, dirs, files in os.walk('.'): path = path[len('./'):] # Pretty up the path. # Prune out directories we want to skip. for skip in skip_dirs: if skip in dirs: dirs.remove(skip) if os.path.basename(path) == 'third_party': third_party_dirs.extend([os.path.join(path, dir) for dir in dirs]) # Don't recurse into any subdirs from here. dirs[:] = [] continue return third_party_dirs
def FindThirdPartyDirs(): """Find all third_party directories underneath the current directory.""" skip_dirs = ('.svn', '.git', # VCS metadata 'out', 'Debug', 'Release', # build files 'layout_tests') # lots of subdirs third_party_dirs = [] for path, dirs, files in os.walk('.'): path = path[len('./'):] # Pretty up the path. # Prune out directories we want to skip. for skip in skip_dirs: if skip in dirs: dirs.remove(skip) if os.path.basename(path) == 'third_party': for dir in dirs: dirpath = os.path.join(path, dir) if dirpath not in PRUNE_PATHS: third_party_dirs.append(dirpath) # Don't recurse into any subdirs from here. dirs[:] = [] continue return third_party_dirs
475,716
def WriteLines(filename, lines): outfile = open(filename, 'w') for line in lines: outfile.write(line) outfile.write('\n')
def WriteLines(filename, lines): outfile = open(filename, 'w') for line in lines: outfile.write(line) outfile.write('\n')
475,717
def WriteLines(filename, lines): outfile = open(filename, 'w') for line in lines: outfile.write(line) outfile.write('\n')
def WriteLines(filename, lines): outfile = open(filename, 'w') for line in lines: outfile.write(line) outfile.write('\n')
475,718
def GetSourcesForTarget(target_name, gyp_file_data): for target in gyp_file_data[GYP_TARGETS_KEY]: if target[GYP_TARGET_NAME_KEY] == target_name: sources = target[GYP_SOURCES_KEY] sources.sort() return sources print 'Warning: no target named ', target, ' found.' return []
def GetSourcesForTarget(target_name, gyp_file_data): for target in gyp_file_data[GYP_TARGETS_KEY]: if target[GYP_TARGET_NAME_KEY] == target_name: sources = target[GYP_SOURCES_KEY] sources.sort() return sources print 'Warning: no target named ', target, ' found.' return []
475,719
def GenerateCIncludeTest(gyp_file_data): c_sources = GetSourcesForTarget('ppapi_c', gyp_file_data) lines = [COPYRIGHT_STRING_C] for source in c_sources: lines.append('#include "ppapi/' + source + '"\n') WriteLines('tests/test_c_includes.c', lines)
def GenerateCIncludeTest(gyp_file_data): c_sources = GetSourcesForTarget('ppapi_c', gyp_file_data) lines = [COPYRIGHT_STRING_C] for source in c_sources: lines.append('#include "ppapi/' + source + '"\n') lines.append('\n WriteLines('tests/all_c_includes.h', lines)
475,720
def GenerateCIncludeTest(gyp_file_data): c_sources = GetSourcesForTarget('ppapi_c', gyp_file_data) lines = [COPYRIGHT_STRING_C] for source in c_sources: lines.append('#include "ppapi/' + source + '"\n') WriteLines('tests/test_c_includes.c', lines)
def GenerateCIncludeTest(gyp_file_data): c_sources = GetSourcesForTarget('ppapi_c', gyp_file_data) lines = [COPYRIGHT_STRING_C] for source in c_sources: lines.append('#include "ppapi/' + source + '"\n') WriteLines('tests/test_c_includes.c', lines)
475,721
def GenerateCCIncludeTest(gyp_file_data): cc_sources = GetSourcesForTarget('ppapi_cpp_objects', gyp_file_data) header_re = re.compile('.+\.h$') lines = [COPYRIGHT_STRING_CC] for source in cc_sources: if header_re.match(source): lines.append('#include "ppapi/' + source + '"\n') WriteLines('tests/test_cc_includes.cc', lines)
def GenerateCCIncludeTest(gyp_file_data): cc_sources = GetSourcesForTarget('ppapi_cpp_objects', gyp_file_data) header_re = re.compile('.+\.h$') lines = [COPYRIGHT_STRING_CC] for source in cc_sources: if header_re.match(source): lines.append('#include "ppapi/' + source + '"\n') lines.append('\n WriteLines('tests/all_cpp_includes.h', lines)
475,722
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
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
475,723
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, 'sconsbuild', 'Release')], 'darwin': [ os.path.join(chrome_src, 'xcodebuild', 'Debug'), os.path.join(chrome_src, 'xcodebuild', 'Release')], 'win32': [ os.path.join(chrome_src, 'chrome', 'Debug'), os.path.join(chrome_src, 'chrome', 'Release')], 'cygwin': [ os.path.join(chrome_src, 'chrome', 'Debug'), os.path.join(chrome_src, 'chrome', 'Release')], } sys.path += bin_dirs.get(sys.platform, [])
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, 'sconsbuild', 'Release')], 'darwin': [ os.path.join(chrome_src, 'xcodebuild', 'Debug'), os.path.join(chrome_src, 'xcodebuild', 'Release')], 'win32': [ os.path.join(chrome_src, 'chrome', 'Debug'), os.path.join(chrome_src, 'chrome', 'Release')], 'cygwin': [ os.path.join(chrome_src, 'chrome', 'Debug'), os.path.join(chrome_src, 'chrome', 'Release')], } sys.path += bin_dirs.get(sys.platform, [])
475,724
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, 'sconsbuild', 'Release')], 'darwin': [ os.path.join(chrome_src, 'xcodebuild', 'Debug'), os.path.join(chrome_src, 'xcodebuild', 'Release')], 'win32': [ os.path.join(chrome_src, 'chrome', 'Debug'), os.path.join(chrome_src, 'chrome', 'Release')], 'cygwin': [ os.path.join(chrome_src, 'chrome', 'Debug'), os.path.join(chrome_src, 'chrome', 'Release')], } sys.path += bin_dirs.get(sys.platform, [])
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, 'sconsbuild', 'Release')], 'darwin': [ os.path.join(chrome_src, 'xcodebuild', 'Debug'), os.path.join(chrome_src, 'xcodebuild', 'Release')], 'win32': [ os.path.join(chrome_src, 'chrome', 'Debug'), os.path.join(chrome_src, 'chrome', 'Release')], 'cygwin': [ os.path.join(chrome_src, 'chrome', 'Debug'), os.path.join(chrome_src, 'chrome', 'Release')], } sys.path += bin_dirs.get(sys.platform, [])
475,725
def __init__(self, methodName='runTest'): PyUITestSuite.__init__(self, sys.argv) unittest.TestCase.__init__(self, methodName)
def __init__(self, methodName='runTest'): pyautolib.PyUITestSuite.__init__(self, sys.argv) browser_dir = os.path.normpath(os.path.dirname(pyautolib.__file__)) os.environ['PATH'] = browser_dir + os.pathsep + os.environ['PATH'] self.Initialize(pyautolib.FilePath(browser_dir)) unittest.TestCase.__init__(self, methodName)
475,726
def __del__(self): PyUITestSuite.__del__(self)
def __del__(self): PyUITestSuite.__del__(self)
475,727
def CompareOutput(self, filename, proc, output, test_args, target): """Implementation of CompareOutput that checks the output image and checksum against the expected files from the LayoutTest directory. """ failures = []
def CompareOutput(self, filename, proc, output, test_args, target): """Implementation of CompareOutput that checks the output image and checksum against the expected files from the LayoutTest directory. """ failures = []
475,728
def __init__(self, methodName='runTest', extra_chrome_flags=None): """Initialize PyUITest.
def __init__(self, methodName='runTest', **kwargs): """Initialize PyUITest.
475,729
def __init__(self, methodName='runTest', extra_chrome_flags=None): """Initialize PyUITest.
def __init__(self, methodName='runTest', extra_chrome_flags=None): """Initialize PyUITest.
475,730
def __init__(self, methodName='runTest', extra_chrome_flags=None): """Initialize PyUITest.
def __init__(self, methodName='runTest', extra_chrome_flags=None): """Initialize PyUITest.
475,731
def __init__(self, methodName='runTest', extra_chrome_flags=None): """Initialize PyUITest.
def __init__(self, methodName='runTest', extra_chrome_flags=None): """Initialize PyUITest.
475,732
def GenerateHeader(file, functions, setName): """Generates gl_binding_autogen_x.h""" # Write file header. file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#ifndef APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper()) file.write('#define APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper()) # Write prototype for initialization function. file.write('\n') file.write('namespace gfx {\n') file.write('\n') file.write('void InitializeGLBindings%s();\n' % setName.upper()) # Write typedefs for function pointer types. Always use the GL name for the # typedef. file.write('\n') for [returnType, names, arguments] in functions: file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % (returnType, names[0], arguments)) # Write declarations for function pointers. Always use the GL name for the # declaration. file.write('\n') for [returnType, names, arguments] in functions: file.write('extern %sProc g_%s;\n' % (names[0], names[0])) file.write('\n') file.write( '} // namespace gfx\n') # Write macros to invoke function pointers. Always use the GL name for the # macro. file.write('\n') for [returnType, names, arguments] in functions: file.write('#define %s ::gfx::g_%s\n' % (names[0], names[0])) file.write('\n') file.write('#endif // APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper())
def GenerateHeader(file, functions, set_name): """Generates gl_binding_autogen_x.h""" # Write file header. file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#ifndef APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper()) file.write('#define APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper()) # Write prototype for initialization function. file.write('\n') file.write('namespace gfx {\n') file.write('\n') file.write('void InitializeGLBindings%s();\n' % setName.upper()) # Write typedefs for function pointer types. Always use the GL name for the # typedef. file.write('\n') for [returnType, names, arguments] in functions: file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % (returnType, names[0], arguments)) # Write declarations for function pointers. Always use the GL name for the # declaration. file.write('\n') for [returnType, names, arguments] in functions: file.write('extern %sProc g_%s;\n' % (names[0], names[0])) file.write('\n') file.write( '} // namespace gfx\n') # Write macros to invoke function pointers. Always use the GL name for the # macro. file.write('\n') for [returnType, names, arguments] in functions: file.write('#define %s ::gfx::g_%s\n' % (names[0], names[0])) file.write('\n') file.write('#endif // APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper())
475,733
file.write('#ifndef APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper())
file.write('#ifndef APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper())
475,734
file.write('#ifndef APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper())
file.write('#ifndef APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper())
475,735
file.write('#ifndef APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper())
file.write('#ifndef APP_GFX_GL_GL_BINDINGS_AUTOGEN_%s_H_\n' % setName.upper())
475,736
file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % (returnType, names[0], arguments))
file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % (returnType, names[0], arguments))
475,737
file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % (returnType, names[0], arguments))
file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % (returnType, names[0], arguments))
475,738
file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % (returnType, names[0], arguments))
file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % (returnType, names[0], arguments))
475,739
file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % (returnType, names[0], arguments))
file.write('typedef %s (GL_BINDING_CALL *%sProc)(%s);\n' % (returnType, names[0], arguments))
475,740
def GenerateSource(file, functions, setName): """Generates gl_binding_autogen_x.cc""" # Write file header. file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include "app/gfx/gl/gl_bindings.h"\n') file.write('#include "app/gfx/gl/gl_implementation.h"\n') # Write definitions of function pointers. file.write('\n') file.write('namespace gfx {\n') file.write('\n') for [returnType, names, arguments] in functions: file.write('%sProc g_%s;\n' % (names[0], names[0])) # Write function to initialize the function pointers. file.write('\n') file.write('void InitializeGLBindings%s() {\n' % setName.upper()) for [returnType, names, arguments] in functions: for name in names: file.write(' if (!g_%s)\n' % names[0]) file.write( ' g_%s = reinterpret_cast<%sProc>(GetGLProcAddress("%s"));\n' % (names[0], names[0], name)) file.write('}\n') file.write('\n') file.write( '} // namespace gfx\n')
def GenerateSource(file, functions, setName): """Generates gl_binding_autogen_x.cc""" # Write file header. file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include "app/gfx/gl/gl_bindings.h"\n') file.write('#include "app/gfx/gl/gl_implementation.h"\n') # Write definitions of function pointers. file.write('\n') file.write('namespace gfx {\n') file.write('\n') for [return_type, names, arguments] in functions: file.write('%sProc g_%s;\n' % (names[0], names[0])) # Write function to initialize the function pointers. file.write('\n') file.write('void InitializeGLBindings%s() {\n' % setName.upper()) for [return_type, names, arguments] in functions: for name in names: file.write(' if (!g_%s)\n' % names[0]) file.write( ' g_%s = reinterpret_cast<%sProc>(GetGLProcAddress("%s"));\n' % (names[0], names[0], name)) file.write('}\n') file.write('\n') file.write( '} // namespace gfx\n')
475,741
def GenerateSource(file, functions, setName): """Generates gl_binding_autogen_x.cc""" # Write file header. file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include "app/gfx/gl/gl_bindings.h"\n') file.write('#include "app/gfx/gl/gl_implementation.h"\n') # Write definitions of function pointers. file.write('\n') file.write('namespace gfx {\n') file.write('\n') for [returnType, names, arguments] in functions: file.write('%sProc g_%s;\n' % (names[0], names[0])) # Write function to initialize the function pointers. file.write('\n') file.write('void InitializeGLBindings%s() {\n' % setName.upper()) for [returnType, names, arguments] in functions: for name in names: file.write(' if (!g_%s)\n' % names[0]) file.write( ' g_%s = reinterpret_cast<%sProc>(GetGLProcAddress("%s"));\n' % (names[0], names[0], name)) file.write('}\n') file.write('\n') file.write( '} // namespace gfx\n')
def GenerateSource(file, functions, setName): """Generates gl_binding_autogen_x.cc""" # Write file header. file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include "app/gfx/gl/gl_bindings.h"\n') file.write('#include "app/gfx/gl/gl_implementation.h"\n') # Write definitions of function pointers. file.write('\n') file.write('namespace gfx {\n') file.write('\n') for [returnType, names, arguments] in functions: file.write('%sProc g_%s;\n' % (names[0], names[0])) # Write function to initialize the function pointers. file.write('\n') file.write('void InitializeGLBindings%s() {\n' % set_name.upper()) for [return_type, names, arguments] in functions: for name in names: file.write(' if (!g_%s)\n' % names[0]) file.write( ' g_%s = reinterpret_cast<%sProc>(GetGLProcAddress("%s"));\n' % (names[0], names[0], name)) file.write('}\n') file.write('\n') file.write( '} // namespace gfx\n')
475,742
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [returnType, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (returnType, names[0], arguments)) argumentNames = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argumentNames == 'void': argumentNames = '' functionName = names[0][2:] if returnType == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [returnType, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [return_type, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (returnType, names[0], arguments)) argumentNames = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argumentNames == 'void': argumentNames = '' functionName = names[0][2:] if returnType == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [return_type, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
475,743
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [returnType, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (returnType, names[0], arguments)) argumentNames = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argumentNames == 'void': argumentNames = '' functionName = names[0][2:] if returnType == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [returnType, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [returnType, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (return_type, names[0], arguments)) argument_names = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argumentNames == 'void': argumentNames = '' functionName = names[0][2:] if returnType == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [returnType, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
475,744
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [returnType, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (returnType, names[0], arguments)) argumentNames = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argumentNames == 'void': argumentNames = '' functionName = names[0][2:] if returnType == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [returnType, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [returnType, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (returnType, names[0], arguments)) argumentNames = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argument_names == 'void': argument_names = '' function_name = names[0][2:] if return_type == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [returnType, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
475,745
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [returnType, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (returnType, names[0], arguments)) argumentNames = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argumentNames == 'void': argumentNames = '' functionName = names[0][2:] if returnType == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [returnType, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [returnType, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (returnType, names[0], arguments)) argumentNames = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argumentNames == 'void': argumentNames = '' functionName = names[0][2:] if returnType == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (function_name, argument_names)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (function_name, argument_names)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [returnType, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
475,746
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [returnType, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (returnType, names[0], arguments)) argumentNames = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argumentNames == 'void': argumentNames = '' functionName = names[0][2:] if returnType == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [returnType, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [returnType, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (returnType, names[0], arguments)) argumentNames = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argumentNames == 'void': argumentNames = '' functionName = names[0][2:] if returnType == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (function_name, argument_names)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (function_name, argument_names)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [returnType, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
475,747
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [returnType, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (returnType, names[0], arguments)) argumentNames = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argumentNames == 'void': argumentNames = '' functionName = names[0][2:] if returnType == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [returnType, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
def GenerateMockSource(file, functions): """Generates functions that invoke a mock GLInterface""" file.write('// Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') file.write('// Use of this source code is governed by a BSD-style license that can be\n') file.write('// found in the LICENSE file.\n') file.write('\n') file.write('// This file is automatically generated.\n') file.write('\n') file.write('#include <string.h>\n') file.write('\n') file.write('#include "app/gfx/gl/gl_interface.h"\n') file.write('\n') file.write('namespace gfx {\n') # Write function that trampoline into the GLInterface. for [return_type, names, arguments] in functions: file.write('\n') file.write('%s GL_BINDING_CALL Mock_%s(%s) {\n' % (returnType, names[0], arguments)) argumentNames = re.sub(r'(const )?[a-zA-Z0-9]+\** ([a-zA-Z0-9]+)', r'\2', arguments) if argumentNames == 'void': argumentNames = '' functionName = names[0][2:] if returnType == 'void': file.write(' GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) else: file.write(' return GLInterface::GetGLInterface()->%s(%s);\n' % (functionName, argumentNames)) file.write('}\n') # Write a function to lookup a mock GL function based on its name. file.write('\n') file.write('void* GL_BINDING_CALL GetMockGLProcAddress(const char* name) {\n') for [return_type, names, arguments] in functions: file.write(' if (strcmp(name, "%s") == 0)\n' % names[0]) file.write(' return reinterpret_cast<void*>(Mock_%s);\n' % names[0]) file.write(' return NULL;\n') file.write('}\n'); file.write('\n') file.write('} // namespace gfx\n')
475,748
def main(argv): """This is the main function.""" if len(argv) >= 1: dir = argv[0] else: dir = '.' for [functions, setName] in FUNCTION_SETS: headerFile = open( os.path.join(dir, 'gl_bindings_autogen_%s.h' % setName), 'wb') GenerateHeader(headerFile, functions, setName) headerFile.close() sourceFile = open( os.path.join(dir, 'gl_bindings_autogen_%s.cc' % setName), 'wb') GenerateSource(sourceFile, functions, setName) sourceFile.close() sourceFile = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb') GenerateMockSource(sourceFile, GL_FUNCTIONS) sourceFile.close()
def main(argv): """This is the main function.""" if len(argv) >= 1: dir = argv[0] else: dir = '.' for [functions, set_name] in FUNCTION_SETS: header_file = open( os.path.join(dir, 'gl_bindings_autogen_%s.h' % set_name), 'wb') GenerateHeader(header_file, functions, set_name) header_file.close() source_file = open( os.path.join(dir, 'gl_bindings_autogen_%s.cc' % set_name), 'wb') GenerateSource(source_file, functions, set_name) source_file.close() source_file = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb') GenerateMockSource(source_file, GL_FUNCTIONS) source_file.close()
475,749
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" count = 0 for arg in func.GetOriginalArgs(): if count == arg_index: (arg_string, parse_result) = 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() vars = { 'name': func.name, 'arg_index': arg_index, 'value_index': value_index, 'gl_func_name': gl_func_name, 'args': ", ".join(arg_strings), 'all_but_last_args': ", ".join(arg_strings[:-1]), 'gl_args': ", ".join(gl_arg_strings), 'parse_result': parse_result, } vars.update(extra) file.Write(test % vars) arg_index += 1
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" count = 0 for arg in func.GetOriginalArgs(): if count == arg_index: (arg_string, parse_result) = 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() vars = { 'test_name': 'GLES2DecoderTest%d' % file.file_num , 'name': func.name, 'arg_index': arg_index, 'value_index': value_index, 'gl_func_name': gl_func_name, 'args': ", ".join(arg_strings), 'all_but_last_args': ", ".join(arg_strings[:-1]), 'gl_args': ", ".join(gl_arg_strings), 'parse_result': parse_result, } vars.update(extra) file.Write(test % vars) arg_index += 1
475,750
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" if func.GetInfo('unit_test') == False: file.Write("// TODO(gman): %s\n" % func.name) return valid_test = """
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
475,751
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" if func.GetInfo('unit_test') == False: file.Write("// TODO(gman): %s\n" % func.name) return valid_test = """
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" if func.GetInfo('unit_test') == False: file.Write("// TODO(gman): %s\n" % func.name) return valid_test = """
475,752
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" if func.GetInfo('unit_test') == False: file.Write("// TODO(gman): %s\n" % func.name) return valid_test = """
def WriteServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" if func.GetInfo('unit_test') == False: file.Write("// TODO(gman): %s\n" % func.name) return valid_test = """
475,753
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,754
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,755
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,756
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,757
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,758
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,759
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,760
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,761
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,762
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteImmediateServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,763
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
475,764
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
475,765
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
475,766
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
def WriteImmediateServiceUnitTest(self, func, file): """Writes the service unit test for a command.""" valid_test = """
475,767
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,768
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
def WriteServiceUnitTest(self, func, file): """Overrriden from TypeHandler.""" valid_test = """
475,769
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 error::kNoError;\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 error::kNoError;\n") file.Write(" }\n")
475,770
def __init__(self, name, info, return_type, original_args, args_for_cmds, cmd_args, init_args, num_pointer_args): self.name = name self.original_name = name self.info = info self.type_handler = info.type_handler self.return_type = return_type self.original_args = original_args self.num_pointer_args = num_pointer_args self.can_auto_generate = num_pointer_args == 0 and return_type == "void" self.cmd_args = cmd_args self.init_args = init_args self.args_for_cmds = args_for_cmds self.type_handler.InitFunction(self)
def __init__(self, original_name, name, info, return_type, original_args, args_for_cmds, cmd_args, init_args, num_pointer_args): self.name = name self.original_name = name self.info = info self.type_handler = info.type_handler self.return_type = return_type self.original_args = original_args self.num_pointer_args = num_pointer_args self.can_auto_generate = num_pointer_args == 0 and return_type == "void" self.cmd_args = cmd_args self.init_args = init_args self.args_for_cmds = args_for_cmds self.type_handler.InitFunction(self)
475,771
def __init__(self, name, info, return_type, original_args, args_for_cmds, cmd_args, init_args, num_pointer_args): self.name = name self.original_name = name self.info = info self.type_handler = info.type_handler self.return_type = return_type self.original_args = original_args self.num_pointer_args = num_pointer_args self.can_auto_generate = num_pointer_args == 0 and return_type == "void" self.cmd_args = cmd_args self.init_args = init_args self.args_for_cmds = args_for_cmds self.type_handler.InitFunction(self)
def __init__(self, name, info, return_type, original_args, args_for_cmds, cmd_args, init_args, num_pointer_args): self.name = name self.original_name = original_name self.info = info self.type_handler = info.type_handler self.return_type = return_type self.original_args = original_args self.num_pointer_args = num_pointer_args self.can_auto_generate = num_pointer_args == 0 and return_type == "void" self.cmd_args = cmd_args self.init_args = init_args self.args_for_cmds = args_for_cmds self.type_handler.InitFunction(self)
475,772
def GetGLFunctionName(self): """Gets the function to call to execute GL for this command.""" if self.GetInfo('DecoderFunc'): return self.GetInfo('DecoderFunc') return "gl%s" % self.original_name
def GetGLFunctionName(self): """Gets the function to call to execute GL for this command.""" if self.GetInfo('decoder_func'): return self.GetInfo('decoder_func') return "gl%s" % self.original_name
475,773
def GetGLTestFunctionName(self): gl_func_name = self.GetInfo('gl_test_func') if gl_func_name == None: gl_func_name = self.GetGLFunctionName() if gl_func_name.startswith("gl"): gl_func_name = gl_func_name[2:] else: gl_func_name = self.name return gl_func_name
def GetGLTestFunctionName(self): gl_func_name = self.GetInfo('gl_test_func') if gl_func_name == None: gl_func_name = self.GetGLFunctionName() if gl_func_name.startswith("gl"): gl_func_name = gl_func_name[2:] else: gl_func_name = self.original_name return gl_func_name
475,774
def __init__(self, func): new_args = [] for arg in func.GetOriginalArgs(): new_arg = arg.GetImmediateVersion() if new_arg: new_args.append(new_arg)
def __init__(self, func): new_args = [] for arg in func.GetOriginalArgs(): new_arg = arg.GetImmediateVersion() if new_arg: new_args.append(new_arg)
475,775
def ParseGLH(self, filename): """Parses the GL2.h file and extracts the functions""" for line in _GL_FUNCTIONS.splitlines(): match = self._function_re.match(line) if match: func_name = match.group(2)[2:] func_info = self.GetFunctionInfo(func_name) if func_info.type != 'Noop': return_type = match.group(1).strip() arg_string = match.group(3) (args, num_pointer_args, is_gl_enum) = self.ParseArgs(arg_string) if is_gl_enum: self.Log("%s uses bare GLenum" % func_name) args_for_cmds = args if hasattr(func_info, 'cmd_args'): (args_for_cmds, num_pointer_args, is_gl_enum) = ( self.ParseArgs(getattr(func_info, 'cmd_args'))) cmd_args = [] for arg in args_for_cmds: arg.AddCmdArgs(cmd_args) init_args = [] for arg in args_for_cmds: arg.AddInitArgs(init_args) return_arg = CreateArg(return_type + " result") if return_arg: init_args.append(return_arg) f = Function(func_name, func_info, return_type, args, args_for_cmds, cmd_args, init_args, num_pointer_args) self.original_functions.append(f) self.AddFunction(f) f.type_handler.AddImmediateFunction(self, f)
def ParseGLH(self, filename): """Parses the GL2.h file and extracts the functions""" for line in _GL_FUNCTIONS.splitlines(): match = self._function_re.match(line) if match: func_name = match.group(2)[2:] func_info = self.GetFunctionInfo(func_name) if func_info.type != 'Noop': return_type = match.group(1).strip() arg_string = match.group(3) (args, num_pointer_args, is_gl_enum) = self.ParseArgs(arg_string) if is_gl_enum: self.Log("%s uses bare GLenum" % func_name) args_for_cmds = args if hasattr(func_info, 'cmd_args'): (args_for_cmds, num_pointer_args, is_gl_enum) = ( self.ParseArgs(getattr(func_info, 'cmd_args'))) cmd_args = [] for arg in args_for_cmds: arg.AddCmdArgs(cmd_args) init_args = [] for arg in args_for_cmds: arg.AddInitArgs(init_args) return_arg = CreateArg(return_type + " result") if return_arg: init_args.append(return_arg) f = Function(func_name, func_name, func_info, return_type, args, args_for_cmds, cmd_args, init_args, num_pointer_args) self.original_functions.append(f) self.AddFunction(f) f.type_handler.AddImmediateFunction(self, f)
475,776
def WriteServiceUnitTests(self, filename): """Writes the service decorder unit tests.""" file = CHeaderWriter( filename, "// It is included by gles2_cmd_decoder_unittest.cc\n")
def WriteServiceUnitTests(self, filename): """Writes the service decorder unit tests.""" file = CHeaderWriter( filename, "// It is included by gles2_cmd_decoder_unittest.cc\n")
475,777
def main(argv): """This is the main function.""" parser = OptionParser() parser.add_option( "-g", "--generate-implementation-templates", action="store_true", help="generates files that are generally hand edited..") parser.add_option( "--generate-command-id-tests", action="store_true", help="generate tests for commands ids. Commands MUST not change ID!") parser.add_option( "-v", "--verbose", action="store_true", help="prints more output.") (options, args) = parser.parse_args(args=argv) gen = GLGenerator(options.verbose) gen.ParseGLH("common/GLES2/gl2.h") gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") gen.WriteFormat("common/gles2_cmd_format_autogen.h") gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_autogen.h") gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") gen.WriteServiceUtilsImplementation( "service/gles2_cmd_validation_implementation_autogen.h") if options.generate_command_id_tests: gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") if gen.errors > 0: print "%d errors" % gen.errors sys.exit(1)
def main(argv): """This is the main function.""" parser = OptionParser() parser.add_option( "-g", "--generate-implementation-templates", action="store_true", help="generates files that are generally hand edited..") parser.add_option( "--generate-command-id-tests", action="store_true", help="generate tests for commands ids. Commands MUST not change ID!") parser.add_option( "-v", "--verbose", action="store_true", help="prints more output.") (options, args) = parser.parse_args(args=argv) gen = GLGenerator(options.verbose) gen.ParseGLH("common/GLES2/gl2.h") gen.WriteCommandIds("common/gles2_cmd_ids_autogen.h") gen.WriteFormat("common/gles2_cmd_format_autogen.h") gen.WriteFormatTest("common/gles2_cmd_format_test_autogen.h") gen.WriteGLES2ImplementationHeader("client/gles2_implementation_autogen.h") gen.WriteGLES2CLibImplementation("client/gles2_c_lib_autogen.h") gen.WriteCmdHelperHeader("client/gles2_cmd_helper_autogen.h") gen.WriteServiceImplementation("service/gles2_cmd_decoder_autogen.h") gen.WriteServiceUnitTests("service/gles2_cmd_decoder_unittest_%d_autogen.h") gen.WriteServiceUtilsHeader("service/gles2_cmd_validation_autogen.h") gen.WriteServiceUtilsImplementation( "service/gles2_cmd_validation_implementation_autogen.h") if options.generate_command_id_tests: gen.WriteCommandIdTest("common/gles2_cmd_id_test_autogen.h") if gen.errors > 0: print "%d errors" % gen.errors sys.exit(1)
475,778
def UpdateGClientBranch(webkit_rev): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) target = FindSVNRev(webkit_rev) if not target: print "ERROR: Couldn't map r%s to a git revision." % webkit_rev sys.exit(1) current = RunGit(['show-ref', '--hash', MAGIC_GCLIENT_BRANCH]) if current == target: return False # No change necessary. subprocess.check_call(['git', 'update-ref', '-m', 'gclient sync', MAGIC_GCLIENT_BRANCH, target], shell=(os.name == 'nt')) return True
def UpdateGClientBranch(webkit_rev, magic_gclient_branch): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) target = FindSVNRev(webkit_rev) if not target: print "ERROR: Couldn't map r%s to a git revision." % webkit_rev sys.exit(1) current = RunGit(['show-ref', '--hash', MAGIC_GCLIENT_BRANCH]) if current == target: return False # No change necessary. subprocess.check_call(['git', 'update-ref', '-m', 'gclient sync', MAGIC_GCLIENT_BRANCH, target], shell=(os.name == 'nt')) return True
475,779
def UpdateGClientBranch(webkit_rev): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) target = FindSVNRev(webkit_rev) if not target: print "ERROR: Couldn't map r%s to a git revision." % webkit_rev sys.exit(1) current = RunGit(['show-ref', '--hash', MAGIC_GCLIENT_BRANCH]) if current == target: return False # No change necessary. subprocess.check_call(['git', 'update-ref', '-m', 'gclient sync', MAGIC_GCLIENT_BRANCH, target], shell=(os.name == 'nt')) return True
def UpdateGClientBranch(webkit_rev): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) target = FindSVNRev(webkit_rev) if not target: print "ERROR: Couldn't map r%s to a git revision." % webkit_rev sys.exit(1) current = RunGit(['show-ref', '--hash', magic_gclient_branch]) if current == target: return False # No change necessary. subprocess.check_call(['git', 'update-ref', '-m', 'gclient sync', MAGIC_GCLIENT_BRANCH, target], shell=(os.name == 'nt')) return True
475,780
def UpdateGClientBranch(webkit_rev): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) target = FindSVNRev(webkit_rev) if not target: print "ERROR: Couldn't map r%s to a git revision." % webkit_rev sys.exit(1) current = RunGit(['show-ref', '--hash', MAGIC_GCLIENT_BRANCH]) if current == target: return False # No change necessary. subprocess.check_call(['git', 'update-ref', '-m', 'gclient sync', MAGIC_GCLIENT_BRANCH, target], shell=(os.name == 'nt')) return True
def UpdateGClientBranch(webkit_rev): """Update the magic gclient branch to point at |webkit_rev|. Returns: true if the branch didn't need changes.""" target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) target = FindSVNRev(webkit_rev) if not target: print "ERROR: Couldn't map r%s to a git revision." % webkit_rev sys.exit(1) current = RunGit(['show-ref', '--hash', MAGIC_GCLIENT_BRANCH]) if current == target: return False # No change necessary. subprocess.check_call(['git', 'update-ref', '-m', 'gclient sync', magic_gclient_branch, target], shell=(os.name == 'nt')) return True
475,781
def UpdateCurrentCheckoutIfAppropriate(): """Reset the current gclient branch if that's what we have checked out.""" branch = RunGit(['symbolic-ref', '-q', 'HEAD']) if branch != MAGIC_GCLIENT_BRANCH: print "We have now updated the 'gclient' branch, but third_party/WebKit" print "has some other branch ('%s') checked out." % branch print "Run 'git checkout gclient' under third_party/WebKit if you want" print "to switch it to the version requested by DEPS." return 1 if subprocess.call(['git', 'diff-index', '--exit-code', '--shortstat', 'HEAD'], shell=(os.name == 'nt')): print "Resetting tree state to new revision." subprocess.check_call(['git', 'reset', '--hard'], shell=(os.name == 'nt'))
def UpdateCurrentCheckoutIfAppropriate(magic_gclient_branch): """Reset the current gclient branch if that's what we have checked out.""" branch = RunGit(['symbolic-ref', '-q', 'HEAD']) if branch != MAGIC_GCLIENT_BRANCH: print "We have now updated the 'gclient' branch, but third_party/WebKit" print "has some other branch ('%s') checked out." % branch print "Run 'git checkout gclient' under third_party/WebKit if you want" print "to switch it to the version requested by DEPS." return 1 if subprocess.call(['git', 'diff-index', '--exit-code', '--shortstat', 'HEAD'], shell=(os.name == 'nt')): print "Resetting tree state to new revision." subprocess.check_call(['git', 'reset', '--hard'], shell=(os.name == 'nt'))
475,782
def UpdateCurrentCheckoutIfAppropriate(): """Reset the current gclient branch if that's what we have checked out.""" branch = RunGit(['symbolic-ref', '-q', 'HEAD']) if branch != MAGIC_GCLIENT_BRANCH: print "We have now updated the 'gclient' branch, but third_party/WebKit" print "has some other branch ('%s') checked out." % branch print "Run 'git checkout gclient' under third_party/WebKit if you want" print "to switch it to the version requested by DEPS." return 1 if subprocess.call(['git', 'diff-index', '--exit-code', '--shortstat', 'HEAD'], shell=(os.name == 'nt')): print "Resetting tree state to new revision." subprocess.check_call(['git', 'reset', '--hard'], shell=(os.name == 'nt'))
def UpdateCurrentCheckoutIfAppropriate(): """Reset the current gclient branch if that's what we have checked out.""" branch = RunGit(['symbolic-ref', '-q', 'HEAD']) if branch != magic_gclient_branch: print "We have now updated the 'gclient' branch, but third_party/WebKit" print "has some other branch ('%s') checked out." % branch print "Run 'git checkout gclient' under third_party/WebKit if you want" print "to switch it to the version requested by DEPS." return 1 if subprocess.call(['git', 'diff-index', '--exit-code', '--shortstat', 'HEAD'], shell=(os.name == 'nt')): print "Resetting tree state to new revision." subprocess.check_call(['git', 'reset', '--hard'], shell=(os.name == 'nt'))
475,783
def main(): if not os.path.exists('third_party/WebKit/.git'): if os.path.exists('third_party/WebKit'): print "ERROR: third_party/WebKit appears to not be under git control." else: print "ERROR: third_party/WebKit could not be found." print "Did you run this script from the right directory?" print "See http://code.google.com/p/chromium/wiki/UsingWebKitGit for" print "setup instructions." return 1 webkit_rev = GetWebKitRev() print 'Desired revision: r%s.' % webkit_rev os.chdir('third_party/WebKit') changed = UpdateGClientBranch(webkit_rev) if changed: return UpdateCurrentCheckoutIfAppropriate() else: print "Already on correct revision." return 0
def main(): if not os.path.exists('third_party/WebKit/.git'): if os.path.exists('third_party/WebKit'): print "ERROR: third_party/WebKit appears to not be under git control." else: print "ERROR: third_party/WebKit could not be found." print "Did you run this script from the right directory?" print "See http://code.google.com/p/chromium/wiki/UsingWebKitGit for" print "setup instructions." return 1 webkit_rev = GetWebKitRev() print 'Desired revision: r%s.' % webkit_rev os.chdir('third_party/WebKit') magic_gclient_branch = GetGClientBranchName() changed = UpdateGClientBranch(webkit_rev, magic_gclient_branch) if changed: return UpdateCurrentCheckoutIfAppropriate() else: print "Already on correct revision." return 0
475,784
def main(): if not os.path.exists('third_party/WebKit/.git'): if os.path.exists('third_party/WebKit'): print "ERROR: third_party/WebKit appears to not be under git control." else: print "ERROR: third_party/WebKit could not be found." print "Did you run this script from the right directory?" print "See http://code.google.com/p/chromium/wiki/UsingWebKitGit for" print "setup instructions." return 1 webkit_rev = GetWebKitRev() print 'Desired revision: r%s.' % webkit_rev os.chdir('third_party/WebKit') changed = UpdateGClientBranch(webkit_rev) if changed: return UpdateCurrentCheckoutIfAppropriate() else: print "Already on correct revision." return 0
def main(): if not os.path.exists('third_party/WebKit/.git'): if os.path.exists('third_party/WebKit'): print "ERROR: third_party/WebKit appears to not be under git control." else: print "ERROR: third_party/WebKit could not be found." print "Did you run this script from the right directory?" print "See http://code.google.com/p/chromium/wiki/UsingWebKitGit for" print "setup instructions." return 1 webkit_rev = GetWebKitRev() print 'Desired revision: r%s.' % webkit_rev os.chdir('third_party/WebKit') changed = UpdateGClientBranch(webkit_rev) if changed: return UpdateCurrentCheckoutIfAppropriate(magic_gclient_branch) else: print "Already on correct revision." return 0
475,785
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # The remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) postamble_length = len(_expected_output_postamble) result = result[content_start:content_end + postamble_length] + "\n" # Remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
def RenderPages(names, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # The remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) postamble_length = len(_expected_output_postamble) result = result[content_start:content_end + postamble_length] + "\n" # Remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
475,786
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # The remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) postamble_length = len(_expected_output_postamble) result = result[content_start:content_end + postamble_length] + "\n" # Remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<names> and writes the results to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # The remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) postamble_length = len(_expected_output_postamble) result = result[content_start:content_end + postamble_length] + "\n" # Remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
475,787
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # The remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) postamble_length = len(_expected_output_postamble) result = result[content_start:content_end + postamble_length] + "\n" # Remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # The remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) postamble_length = len(_expected_output_postamble) result = result[content_start:content_end + postamble_length] + "\n" # Remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
475,788
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # The remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) postamble_length = len(_expected_output_postamble) result = result[content_start:content_end + postamble_length] + "\n" # Remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
def RenderPage(name, test_shell): """ Calls test_shell --layout-tests .../generator.html?<name> and writes the result to .../docs/<name>.html """ if not name: raise Exception("RenderPage called with empty name") generator_url = "file:" + urllib.pathname2url(_generator_html) + "?" + name input_file = _base_dir + "/" + name + ".html" # Copy page_shell to destination output and move aside original, if it exists. original = None if (os.path.isfile(input_file)): original = open(input_file, 'rb').read() os.remove(input_file) shutil.copy(_page_shell_html, input_file) # Run test_shell and capture result p = Popen([test_shell, "--layout-tests", generator_url], stdout=PIPE) # The remaining output will be the content of the generated page. result = p.stdout.read() content_start = result.find(_expected_output_preamble) content_end = result.find(_expected_output_postamble) if (content_start < 0): if (result.startswith("#TEST_TIMED_OUT")): raise Exception("test_shell returned TEST_TIMED_OUT.\n" + "Their was probably a problem with generating the " + "page\n" + "Try copying template/page_shell.html to:\n" + input_file + "\nAnd open it in chrome using the file: scheme.\n" + "Look from javascript errors via the inspector.") raise Exception("test_shell returned unexpected output: " + result) postamble_length = len(_expected_output_postamble) result = result[content_start:content_end + postamble_length] + "\n" # Remove the trailing #EOF that test shell appends to the output. result = result.replace('#EOF', '') # Remove page_shell os.remove(input_file) # Remove CRs that are appearing from captured test_shell output. result = result.replace('\r', '') # Write output open(input_file, 'wb').write(result) if (original and result == original): return None else: return input_file
475,789
def FindTestShell(): # This is hacky. It is used to guess the location of the test_shell chrome_dir = os.path.normpath(_base_dir + "/../../../") src_dir = os.path.normpath(chrome_dir + "/../") search_locations = [] if (sys.platform in ('cygwin', 'win32')): home_dir = os.path.normpath(os.getenv("HOMEDRIVE") + os.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception ("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
def FindTestShell(): # This is hacky. It is used to guess the location of the test_shell chrome_dir = os.path.normpath(_base_dir + "/../../../") src_dir = os.path.normpath(chrome_dir + "/../") search_locations = [] if (sys.platform in ('cygwin', 'win32')): home_dir = os.path.normpath(os.getenv("HOMEDRIVE") + os.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception ("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
475,790
def FindTestShell(): # This is hacky. It is used to guess the location of the test_shell chrome_dir = os.path.normpath(_base_dir + "/../../../") src_dir = os.path.normpath(chrome_dir + "/../") search_locations = [] if (sys.platform in ('cygwin', 'win32')): home_dir = os.path.normpath(os.getenv("HOMEDRIVE") + os.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception ("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
def FindTestShell(): # This is hacky. It is used to guess the location of the test_shell chrome_dir = os.path.normpath(_base_dir + "/../../../") src_dir = os.path.normpath(chrome_dir + "/../") search_locations = [] if (sys.platform in ('cygwin', 'win32')): home_dir = os.path.normpath(os.getenv("HOMEDRIVE") + os.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception ("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
475,791
def FindTestShell(): # This is hacky. It is used to guess the location of the test_shell chrome_dir = os.path.normpath(_base_dir + "/../../../") src_dir = os.path.normpath(chrome_dir + "/../") search_locations = [] if (sys.platform in ('cygwin', 'win32')): home_dir = os.path.normpath(os.getenv("HOMEDRIVE") + os.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception ("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
def FindTestShell(): # This is hacky. It is used to guess the location of the test_shell chrome_dir = os.path.normpath(_base_dir + "/../../../") src_dir = os.path.normpath(chrome_dir + "/../") search_locations = [] if (sys.platform in ('cygwin', 'win32')): home_dir = os.path.normpath(os.getenv("HOMEDRIVE") + os.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception ("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
475,792
def FindTestShell(): # This is hacky. It is used to guess the location of the test_shell chrome_dir = os.path.normpath(_base_dir + "/../../../") src_dir = os.path.normpath(chrome_dir + "/../") search_locations = [] if (sys.platform in ('cygwin', 'win32')): home_dir = os.path.normpath(os.getenv("HOMEDRIVE") + os.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception ("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
def FindTestShell(): # This is hacky. It is used to guess the location of the test_shell chrome_dir = os.path.normpath(_base_dir + "/../../../") src_dir = os.path.normpath(chrome_dir + "/../") search_locations = [] if (sys.platform in ('cygwin', 'win32')): home_dir = os.path.normpath(os.getenv("HOMEDRIVE") + os.getenv("HOMEPATH")) search_locations.append(chrome_dir + "/Debug/test_shell.exe") search_locations.append(chrome_dir + "/Release/test_shell.exe") search_locations.append(home_dir + "/bin/test_shell/" + "test_shell.exe") if (sys.platform in ('linux', 'linux2')): search_locations.append(src_dir + "/sconsbuild/Debug/test_shell") search_locations.append(src_dir + "/out/Debug/test_shell") search_locations.append(src_dir + "/sconsbuild/Release/test_shell") search_locations.append(src_dir + "/out/Release/test_shell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/test_shell") if (sys.platform == 'darwin'): search_locations.append(src_dir + "/xcodebuild/Debug/TestShell.app/Contents/MacOS/TestShell") search_locations.append(src_dir + "/xcodebuild/Release/TestShell.app/Contents/MacOS/TestShell") search_locations.append(os.getenv("HOME") + "/bin/test_shell/" + "TestShell.app/Contents/MacOS/TestShell") for loc in search_locations: if os.path.isfile(loc): return loc raise Exception("Could not find test_shell executable\n" + "**test_shell may need to be built**\n" + "Searched: \n" + "\n".join(search_locations) + "\n" + "To specify a path to test_shell use --test-shell-path")
475,793
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script.") parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = [] for page in page_names: modified_file = RenderPage(page, test_shell) if (modified_file): modified_files.append(modified_file) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1) debug_log = os.path.normpath(_build_dir + "/" + "debug.log") if (os.path.isfile(debug_log)): os.remove(debug_log) return os.EX_OK
def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script.") parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") (options, args) = parser.parse_args() if (options.test_shell_path and os.path.isfile(options.test_shell_path)): test_shell = options.test_shell_path else: test_shell = FindTestShell() # Read static file names static_names = GetStaticFileNames() # Read module names module_names = GetAPIModuleNames() # All pages to generate page_names = static_names | module_names modified_files = RenderPages(page_names, test_shell) if (len(modified_files) == 0): print "Output files match existing files. No changes made." else: print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + "The following files have been modified and should be checked\n" + "into source control (ideally in the same changelist as the\n" + "underlying files that resulting in their changing).") for f in modified_files: print f # Hack. Sleep here, otherwise windows doesn't properly close the debug.log # and the os.remove will fail with a "Permission denied". time.sleep(1) debug_log = os.path.normpath(_build_dir + "/" + "debug.log") if (os.path.isfile(debug_log)): os.remove(debug_log) return os.EX_OK
475,794
def testFillProfileCrazyCharacters(self): """Test filling profiles with unicode strings and crazy characters.""" # Adding autofill profiles. file_path = os.path.join(self.DataDir(), 'autofill', 'crazy_autofill.txt') profiles = self.EvalDataFrom(file_path) self.FillAutoFillProfile(profiles=profiles)
def testFillProfileCrazyCharacters(self): """Test filling profiles with unicode strings and crazy characters.""" # Adding autofill profiles. file_path = os.path.join(self.DataDir(), 'autofill', 'crazy_autofill.txt') profiles = self.EvalDataFrom(file_path) self.FillAutoFillProfile(profiles=profiles)
475,795
def testAutofillInvalid(self): """Test filling in invalid values for profiles and credit cards.""" # First try profiles with invalid input. without_invalid = {'NAME_FIRST': u'Will', 'ADDRESS_HOME_CITY': 'Sunnyvale', 'ADDRESS_HOME_STATE': 'CA', 'ADDRESS_HOME_ZIP': 'my_zip', 'ADDRESS_HOME_COUNTRY': 'USA'} # Add some invalid fields. with_invalid = without_invalid.copy() with_invalid['PHONE_HOME_WHOLE_NUMBER'] = 'Invalid_Phone_Number' with_invalid['PHONE_FAX_WHOLE_NUMBER'] = 'Invalid_Fax_Number' self.FillAutoFillProfile(profiles=[with_invalid]) self.assertEqual([without_invalid], self.GetAutoFillProfile()['profiles'])
def testAutofillInvalid(self): """Test filling in invalid values for profiles and credit cards.""" # First try profiles with invalid input. without_invalid = {'NAME_FIRST': u'Will', 'ADDRESS_HOME_CITY': 'Sunnyvale', 'ADDRESS_HOME_STATE': 'CA', 'ADDRESS_HOME_ZIP': 'my_zip', 'ADDRESS_HOME_COUNTRY': 'USA'} # Add some invalid fields. with_invalid = without_invalid.copy() with_invalid['PHONE_HOME_WHOLE_NUMBER'] = 'Invalid_Phone_Number' with_invalid['PHONE_FAX_WHOLE_NUMBER'] = 'Invalid_Fax_Number' self.FillAutoFillProfile(profiles=[with_invalid]) self.assertEqual([without_invalid], self.GetAutoFillProfile()['profiles'])
475,796
def testAutofillInvalid(self): """Test filling in invalid values for profiles and credit cards.""" # First try profiles with invalid input. without_invalid = {'NAME_FIRST': u'Will', 'ADDRESS_HOME_CITY': 'Sunnyvale', 'ADDRESS_HOME_STATE': 'CA', 'ADDRESS_HOME_ZIP': 'my_zip', 'ADDRESS_HOME_COUNTRY': 'USA'} # Add some invalid fields. with_invalid = without_invalid.copy() with_invalid['PHONE_HOME_WHOLE_NUMBER'] = 'Invalid_Phone_Number' with_invalid['PHONE_FAX_WHOLE_NUMBER'] = 'Invalid_Fax_Number' self.FillAutoFillProfile(profiles=[with_invalid]) self.assertEqual([without_invalid], self.GetAutoFillProfile()['profiles'])
def testAutofillInvalid(self): """Test filling in invalid values for profiles and credit cards.""" # First try profiles with invalid input. without_invalid = {'NAME_FIRST': u'Will', 'ADDRESS_HOME_CITY': 'Sunnyvale', 'ADDRESS_HOME_STATE': 'CA', 'ADDRESS_HOME_ZIP': 'my_zip', 'ADDRESS_HOME_COUNTRY': 'USA'} # Add some invalid fields. with_invalid = without_invalid.copy() with_invalid['PHONE_HOME_WHOLE_NUMBER'] = 'Invalid_Phone_Number' with_invalid['PHONE_FAX_WHOLE_NUMBER'] = 'Invalid_Fax_Number' self.FillAutoFillProfile(profiles=[with_invalid]) self.assertEqual([without_invalid], self.GetAutoFillProfile()['profiles'])
475,797
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)
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)
475,798
def TestRemoting(self): return self.SimpleTest("chrome", "remoting_unittests", cmd_args=[ "--ui-test-timeout=240000", "--ui-test-action-timeout=120000", "--ui-test-action-max-timeout=280000"])
def TestRemoting(self): return self.SimpleTest("chrome", "remoting_unittests", cmd_args=[ "--ui-test-timeout=240000", "--ui-test-action-timeout=120000", "--ui-test-action-max-timeout=280000"])
475,799