def testWprRecorderWithBenchmark(self): flags = ['--mock-benchmark-url', self._url] mock_benchmark = MockBenchmark() wpr_recorder = record_wpr.WprRecorder(self._test_data_dir, mock_benchmark, flags) results = wpr_recorder.CreateResults() wpr_recorder.Record(results) self.assertEqual(set(mock_benchmark.mock_page_set.pages), results.pages_that_succeeded)
def testWprRecorderWithPageSet(self): flags = [] mock_page_set = MockPageSet(url=self._url) wpr_recorder = record_wpr.WprRecorder(self._test_data_dir, mock_page_set, flags) results = wpr_recorder.CreateResults() wpr_recorder.Record(results) self.assertEqual(set(mock_page_set.pages), results.pages_that_succeeded)
def testPageSetBaseDirFlag(self): flags = [ '--page-set-base-dir', self._test_data_dir, '--mock-benchmark-url', self._url, '--browser', self._browser.browser_type, '--device', self._device ] mock_benchmark = MockBenchmark() wpr_recorder = record_wpr.WprRecorder( 'non-existent-dummy-dir', mock_benchmark, flags) results = wpr_recorder.CreateResults() wpr_recorder.Record(results) self.assertEqual(set(mock_benchmark.mock_page_set.pages), results.pages_that_succeeded)
def testCommandLineFlags(self): flags = [ '--page-repeat', '2', '--mock-benchmark-url', self._url, '--upload', ] wpr_recorder = record_wpr.WprRecorder(self._test_data_dir, MockBenchmark(), flags) # page_runner command-line args self.assertEquals(2, wpr_recorder.options.page_repeat) # benchmark command-line args self.assertEquals(self._url, wpr_recorder.options.mock_benchmark_url) # record_wpr command-line arg to upload to cloud-storage. self.assertTrue(wpr_recorder.options.upload) # invalid command-line args self.assertFalse(hasattr(wpr_recorder.options, 'not_a_real_option'))
def testRecordingEnabled(self): flags = ['--mock-benchmark-url', self._url] wpr_recorder = record_wpr.WprRecorder(self._test_data_dir, MockBenchmark(), flags) self.assertEqual(wpr_modes.WPR_RECORD, wpr_recorder.options.browser_options.wpr_mode)