def setUp(self): super(PageTestUnitTest, self).setUp() all_page_actions.RegisterClassForTest('append', AppendAction) all_page_actions.RegisterClassForTest('wrap_append', WrapAppendAction) self._page_test = DoNothingPageTest('action_to_run') self._page = _CreatePage('blank.html')
def testActions(self): action_called = [False] class MockAction(page_action.PageAction): def RunAction(self, page, tab, previous_action): action_called[0] = True all_page_actions.RegisterClassForTest('mock', MockAction) ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html') setattr(ps.pages[0], 'test_action', {'action': 'mock'}) benchmark = BenchWithAction() self.RunBenchmark(benchmark, ps, options=self._options) self.assertTrue(action_called[0])
def testActions(self): action_called = [False] class MockAction(page_action.PageAction): def RunAction(self, page, tab): action_called[0] = True all_page_actions.RegisterClassForTest('mock', MockAction) ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html') setattr(ps.pages[0], 'RunTestAction', {'action': 'mock'}) measurement = MeasurementWithAction() self.RunMeasurement(measurement, ps, options=self._options) self.assertTrue(action_called[0])