Beispiel #1
0
 def testHTMLPreloadScannerWhitelisting(self):
     reference_url_set = set(
         [self.GetResourceUrl('./'),
          self.GetResourceUrl('0.png')])
     url_set = sandwich_misc.ExtractDiscoverableUrls(
         self._TRACE_PATH, sandwich_misc.HTML_PRELOAD_SCANNER_DISCOVERER)
     self.assertEquals(reference_url_set, url_set)
Beispiel #2
0
 def testParserDiscoverableWhitelisting(self):
     reference_url_set = set([
         self.GetResourceUrl('./'),
         self.GetResourceUrl('0.png'),
         self.GetResourceUrl('1.png')
     ])
     url_set = sandwich_misc.ExtractDiscoverableUrls(
         self._TRACE_PATH, sandwich_misc.PARSER_DISCOVERER)
     self.assertEquals(reference_url_set, url_set)
Beispiel #3
0
 def testFullCacheWhitelisting(self):
     reference_url_set = set([
         self.GetResourceUrl('./'),
         self.GetResourceUrl('0.png'),
         self.GetResourceUrl('1.png'),
         self.GetResourceUrl('favicon.ico')
     ])
     url_set = sandwich_misc.ExtractDiscoverableUrls(
         self._TRACE_PATH, sandwich_misc.FULL_CACHE_DISCOVERER)
     self.assertEquals(reference_url_set, url_set)
Beispiel #4
0
    def SetupBenchmark():
      trace_path = os.path.join(self._subresources_for_urls_run_task.path, '0',
                                sandwich_runner.TRACE_FILENAME)
      whitelisted_urls = sandwich_misc.ExtractDiscoverableUrls(
          trace_path, subresource_discoverer)

      urls_resources = json.load(open(self._subresources_for_urls_task.path))
      # TODO(gabadie): Implement support for multiple URLs in this Task.
      assert len(urls_resources) == 1
      url = urls_resources.keys()[0]
      url_resources = urls_resources[url]
      common_util.EnsureParentDirectoryExists(SetupBenchmark.path)
      with open(SetupBenchmark.path, 'w') as output:
        json.dump({
            'cache_whitelist': [url for url in whitelisted_urls],
            'subresource_discoverer': subresource_discoverer,
            'url_resources': url_resources,
          }, output)
Beispiel #5
0
 def testRedirectedMainWhitelisting(self):
     reference_url_set = set([self.GetResourceUrl('./')])
     url_set = sandwich_misc.ExtractDiscoverableUrls(
         self._TRACE_PATH, sandwich_misc.REDIRECTED_MAIN_DISCOVERER)
     self.assertEquals(reference_url_set, url_set)
Beispiel #6
0
 def testNoDiscovererWhitelisting(self):
     url_set = sandwich_misc.ExtractDiscoverableUrls(
         self._TRACE_PATH, sandwich_misc.EMPTY_CACHE_DISCOVERER)
     self.assertEquals(set(), url_set)