Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: tools/telemetry/telemetry/page/page_runner_unittest.py

Issue 692973003: [Telemetry] Introduce RunState.SetUpBeforeRunPage and RunState.TearDownAfterRunPage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready to land Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/telemetry/telemetry/page/page_runner.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 import tempfile 6 import tempfile
7 import unittest 7 import unittest
8 import StringIO 8 import StringIO
9 import sys 9 import sys
10 import tempfile 10 import tempfile
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 _make_javascript_deterministic=False): 680 _make_javascript_deterministic=False):
681 self.archive_path = archive_path 681 self.archive_path = archive_path
682 self.wpr_mode = wpr_mode 682 self.wpr_mode = wpr_mode
683 683
684 684
685 class RunStateTest(unittest.TestCase): 685 class RunStateTest(unittest.TestCase):
686 686
687 # pylint: disable=W0212 687 # pylint: disable=W0212
688 def TestUseLiveSitesFlag(self, options, expected_wpr_mode): 688 def TestUseLiveSitesFlag(self, options, expected_wpr_mode):
689 with tempfile.NamedTemporaryFile() as f: 689 with tempfile.NamedTemporaryFile() as f:
690 run_state = page_runner._RunState(DummyTest()) 690 run_state = page_runner._RunState(DummyTest(), options)
691 fake_network_controller = FakeNetworkController() 691 fake_network_controller = FakeNetworkController()
692 run_state._PrepareWpr(options, fake_network_controller, f.name, None) 692 run_state._PrepareWpr(fake_network_controller, f.name, None)
693 self.assertEquals(fake_network_controller.wpr_mode, expected_wpr_mode) 693 self.assertEquals(fake_network_controller.wpr_mode, expected_wpr_mode)
694 self.assertEquals(fake_network_controller.archive_path, f.name) 694 self.assertEquals(fake_network_controller.archive_path, f.name)
695 695
696 def testUseLiveSitesFlagSet(self): 696 def testUseLiveSitesFlagSet(self):
697 options = options_for_unittests.GetCopy() 697 options = options_for_unittests.GetCopy()
698 options.output_formats = ['none'] 698 options.output_formats = ['none']
699 options.suppress_gtest_report = True 699 options.suppress_gtest_report = True
700 options.use_live_sites = True 700 options.use_live_sites = True
701 SetUpPageRunnerArguments(options) 701 SetUpPageRunnerArguments(options)
702 self.TestUseLiveSitesFlag(options, expected_wpr_mode=wpr_modes.WPR_OFF) 702 self.TestUseLiveSitesFlag(options, expected_wpr_mode=wpr_modes.WPR_OFF)
703 703
704 def testUseLiveSitesFlagUnset(self): 704 def testUseLiveSitesFlagUnset(self):
705 options = options_for_unittests.GetCopy() 705 options = options_for_unittests.GetCopy()
706 options.output_formats = ['none'] 706 options.output_formats = ['none']
707 options.suppress_gtest_report = True 707 options.suppress_gtest_report = True
708 SetUpPageRunnerArguments(options) 708 SetUpPageRunnerArguments(options)
709 self.TestUseLiveSitesFlag(options, expected_wpr_mode=wpr_modes.WPR_REPLAY) 709 self.TestUseLiveSitesFlag(options, expected_wpr_mode=wpr_modes.WPR_REPLAY)
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/page/page_runner.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698