def testTranslateScalarValue(self): story_set = story.StorySet(base_dir=os.path.dirname(__file__)) p = page.Page('http://www.foo.com/', story_set, story_set.base_dir) scalar_value = { 'type': 'numeric', 'numeric': { 'type': 'scalar', 'unit': 'timeInMs_smallerIsBetter', 'value': 42 }, 'name': 'foo', 'description': 'desc' } v = common_value_helpers.TranslateScalarValue(scalar_value, p) self.assertIsInstance(v, scalar.ScalarValue) self.assertEquals('foo', v.name) self.assertEquals(p, v.page) self.assertEquals('timeInMs', v.units) self.assertEquals(42, v.value) self.assertEquals(improvement_direction.DOWN, v.improvement_direction) self.assertEquals('desc', v.description)
def testPageTestWithCompatibleStory(self): original_run_fn = story_runner.Run was_run = [False] def RunStub(*arg, **kwargs): del arg, kwargs was_run[0] = True story_runner.Run = RunStub try: options = options_for_unittests.GetCopy() options.output_formats = ['none'] options.suppress_gtest_report = True parser = optparse.OptionParser() benchmark.AddCommandLineArgs(parser) options.MergeDefaultValues(parser.get_default_values()) b = TestBenchmark(page.Page(url='about:blank', name='about:blank')) b.Run(options) finally: story_runner.Run = original_run_fn self.assertTrue(was_run[0])
def _MakeStorySet(): story_set = story.StorySet(base_dir=os.path.dirname(__file__)) story_set.AddStory( page_module.Page('http://www.foo.com/', story_set, story_set.base_dir)) story_set.AddStory( page_module.Page('http://www.bar.com/', story_set, story_set.base_dir)) story_set.AddStory( page_module.Page('http://www.baz.com/', story_set, story_set.base_dir)) story_set.AddStory( page_module.Page('http://www.roz.com/', story_set, story_set.base_dir)) story_set.AddStory( page_module.Page('http://www.fus.com/', story_set, story_set.base_dir, grouping_keys=_GROUPING_KEY_DEFAULT)) story_set.AddStory( page_module.Page('http://www.ro.com/', story_set, story_set.base_dir, grouping_keys=_GROUPING_KEY_DEFAULT)) return story_set
def _MakeStorySet(): story_set = story.StorySet() story_set.AddStory( page_module.Page('http://www.foo.com/', story_set, name='http://www.foo.com/')) story_set.AddStory( page_module.Page('http://www.bar.com/', story_set, name='http://www.bar.com/')) story_set.AddStory( page_module.Page('http://www.baz.com/', story_set, name='http://www.baz.com/')) story_set.AddStory( page_module.Page('http://www.roz.com/', story_set, name='http://www.roz.com/')) story_set.AddStory( page_module.Page('http://www.fus.com/', story_set, grouping_keys=_GROUPING_KEY_DEFAULT, name='http://www.fus.com/')) story_set.AddStory( page_module.Page('http://www.ro.com/', story_set, grouping_keys=_GROUPING_KEY_DEFAULT, name='http://www.ro.com/')) return story_set
def CreateStorySet(self, options): indexeddb_dir = os.path.join(path_util.GetChromiumSrcDir(), 'chrome', 'test', 'data', 'indexeddb') ps = story.StorySet(base_dir=indexeddb_dir) ps.AddStory(page_module.Page('file://perf_test.html', ps, ps.base_dir)) return ps
def setUp(self): story_set = story.StorySet(base_dir=os.path.dirname(__file__)) story_set.AddStory( page_module.Page('http://www.bar.com/', story_set, story_set.base_dir, name='http://www.bar.com/')) self.story_set = story_set
def _MakeStorySet(): ps = story.StorySet(base_dir=os.path.dirname(__file__)) ps.AddStory(page_module.Page('http://www.foo.com/', ps, ps.base_dir)) ps.AddStory(page_module.Page('http://www.bar.com/', ps, ps.base_dir)) return ps
def setUp(self): ps = page_set.PageSet(file_path=os.path.dirname(__file__)) ps.AddUserStory(page_module.Page('http://www.bar.com/', ps, ps.base_dir)) ps.AddUserStory(page_module.Page('http://www.baz.com/', ps, ps.base_dir)) ps.AddUserStory(page_module.Page('http://www.foo.com/', ps, ps.base_dir)) self.page_set = ps
def testDisplayUrlForHttp(self): self.assertEquals( page.Page('http://www.foo.com/').display_url, 'www.foo.com/')
def page_set(self): page = page_module.Page('http://example.com', name='dummy_page', tags=['foo', 'bar']) story_set = story_module.StorySet() story_set.AddStory(page) return story_set
def setUp(self): self.page_set = page_set.PageSet(file_path=os.path.dirname(__file__)) self.page_set.AddUserStory(page_module.Page( 'http://www.bar.com/', self.page_set, self.page_set.base_dir))
def setUp(self): story_set = story.StorySet(base_dir=os.path.dirname(__file__)) story_set.AddStory(page_module.Page("http://www.bar.com/", story_set, story_set.base_dir)) story_set.AddStory(page_module.Page("http://www.baz.com/", story_set, story_set.base_dir)) story_set.AddStory(page_module.Page("http://www.foo.com/", story_set, story_set.base_dir)) self.story_set = story_set
def CreatePageSet(self, options): indexeddb_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', 'data', 'indexeddb') ps = page_set.PageSet(file_path=indexeddb_dir) ps.AddUserStory(page_module.Page('file://perf_test.html', ps, ps.base_dir)) return ps
def CreatePageSet(self, options): spaceport_dir = os.path.join(util.GetChromiumSrcDir(), 'chrome', 'test', 'data', 'third_party', 'spaceport') ps = page_set.PageSet(file_path=spaceport_dir) ps.AddUserStory(page_module.Page('file://index.html', ps, ps.base_dir)) return ps
def testDisplayUrlForFile(self): self.assertEquals( page.Page('file:///../../otherdir/file.html').display_url, 'file.html')
def _MakePageSet(): ps = page_set.PageSet(base_dir=os.path.dirname(__file__)) ps.AddUserStory(page_module.Page('http://www.foo.com/', ps, ps.base_dir)) ps.AddUserStory(page_module.Page('http://www.bar.com/', ps, ps.base_dir)) return ps
def testGetUrlBaseDirAndFileForAbsolutePath(self): apage = page.Page('file:///somedir/otherdir/file.html', base_dir='basedir') dirname, filename = apage.url_base_dir_and_file self.assertEqual(dirname, 'basedir/somedir/otherdir') self.assertEqual(filename, 'file.html')
def testPageTestWithCompatibleStory(self, mock_run_story_set): b = TestBenchmark(page.Page(url='about:blank', name='about:blank')) b.Run(self.options) self.assertTrue(mock_run_story_set.called)
def CreateStorySet(self, options): ps = story.StorySet(base_dir=_SPEEDOMETER_DIR, serving_dirs=[_SPEEDOMETER_DIR]) ps.AddStory(page_module.Page( 'file://InteractiveRunner.html', ps, ps.base_dir, name='Speedometer2')) return ps