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

Side by Side Diff: chrome/test/functional/perf_endure.py

Issue 10803002: Run Chrome Endure tests with network simulation via Web Page Replay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Nirnimesh, Dennis, Steve's comments Created 8 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/chrome_endure/webpagereplay/wpr_deterministic.js ('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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Performance tests for Chrome Endure (long-running perf tests on Chrome). 6 """Performance tests for Chrome Endure (long-running perf tests on Chrome).
7 7
8 This module accepts the following environment variable inputs: 8 This module accepts the following environment variable inputs:
9 TEST_LENGTH: The number of seconds in which to run each test. 9 TEST_LENGTH: The number of seconds in which to run each test.
10 PERF_STATS_INTERVAL: The number of seconds to wait in-between each sampling 10 PERF_STATS_INTERVAL: The number of seconds to wait in-between each sampling
11 of performance/memory statistics. 11 of performance/memory statistics.
12 12
13 DEEP_MEMORY_PROFILE: Enable the Deep Memory Profiler if it's set to 'True'. 13 DEEP_MEMORY_PROFILE: Enable the Deep Memory Profiler if it's set to 'True'.
14 DEEP_MEMORY_PROFILE_INTERVAL: The number of seconds to wait in-between each 14 DEEP_MEMORY_PROFILE_INTERVAL: The number of seconds to wait in-between each
15 sampling for the Deep Memory Profiler. 15 sampling for the Deep Memory Profiler.
16 DEEP_MEMORY_PROFILE_SAVE: Don't clean up dump files if it's set to 'True'. 16 DEEP_MEMORY_PROFILE_SAVE: Don't clean up dump files if it's set to 'True'.
17
18 ENDURE_NO_WPR: Run tests without Web Page Replay if it's set.
19 WPR_RECORD: Run tests in record mode. If you want to make a fresh
20 archive, please make sure to delete the old one, otherwise
21 it will append to the old one.
Nirnimesh 2012/08/07 17:17:34 remove 'please'
fdeng 2012/08/07 21:24:19 Done.
22 WPR_ARCHIVE_PATH: an alternative archive file to use.
17 """ 23 """
18 24
19 from datetime import datetime 25 from datetime import datetime
20 import json 26 import json
21 import logging 27 import logging
22 import os 28 import os
23 import re 29 import re
24 import subprocess 30 import subprocess
25 import tempfile 31 import tempfile
26 import time 32 import time
27 33
28 import perf 34 import perf
29 import pyauto_functional # Must be imported before pyauto. 35 import pyauto_functional # Must be imported before pyauto.
30 import pyauto 36 import pyauto
31 import pyauto_errors 37 import pyauto_errors
32 import pyauto_utils 38 import pyauto_utils
33 import remote_inspector_client 39 import remote_inspector_client
34 import selenium.common.exceptions 40 import selenium.common.exceptions
35 from selenium.webdriver.support.ui import WebDriverWait 41 from selenium.webdriver.support.ui import WebDriverWait
42 import webpagereplay
36 43
37 44
38 class NotSupportedEnvironmentError(RuntimeError): 45 class NotSupportedEnvironmentError(RuntimeError):
39 """Represent an error raised since the environment (OS) is not supported.""" 46 """Represent an error raised since the environment (OS) is not supported."""
40 pass 47 pass
41 48
49
42 class ChromeEndureBaseTest(perf.BasePerfTest): 50 class ChromeEndureBaseTest(perf.BasePerfTest):
43 """Implements common functionality for all Chrome Endure tests. 51 """Implements common functionality for all Chrome Endure tests.
44 52
45 All Chrome Endure test classes should inherit from this class. 53 All Chrome Endure test classes should inherit from this class.
46 """ 54 """
47 55
48 _DEFAULT_TEST_LENGTH_SEC = 60 * 60 * 6 # Tests run for 6 hours. 56 _DEFAULT_TEST_LENGTH_SEC = 60 * 60 * 6 # Tests run for 6 hours.
49 _GET_PERF_STATS_INTERVAL = 60 * 5 # Measure perf stats every 5 minutes. 57 _GET_PERF_STATS_INTERVAL = 60 * 5 # Measure perf stats every 5 minutes.
50 # TODO(dennisjeffrey): Do we still need to tolerate errors? 58 # TODO(dennisjeffrey): Do we still need to tolerate errors?
51 _ERROR_COUNT_THRESHOLD = 50 # Number of ChromeDriver errors to tolerate. 59 _ERROR_COUNT_THRESHOLD = 50 # Number of ChromeDriver errors to tolerate.
52 _DEEP_MEMORY_PROFILE = False 60 _DEEP_MEMORY_PROFILE = False
53 _DEEP_MEMORY_PROFILE_INTERVAL = _GET_PERF_STATS_INTERVAL 61 _DEEP_MEMORY_PROFILE_INTERVAL = _GET_PERF_STATS_INTERVAL
54 _DEEP_MEMORY_PROFILE_SAVE = False 62 _DEEP_MEMORY_PROFILE_SAVE = False
55 63
56 _DMPROF_DIR_PATH = os.path.join( 64 _DMPROF_DIR_PATH = os.path.join(
57 os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, 65 os.path.dirname(__file__), os.pardir, os.pardir, os.pardir,
58 'tools', 'deep_memory_profiler') 66 'tools', 'deep_memory_profiler')
59 67
60 _DMPROF_SCRIPT_PATH = os.path.join(_DMPROF_DIR_PATH, 'dmprof') 68 _DMPROF_SCRIPT_PATH = os.path.join(_DMPROF_DIR_PATH, 'dmprof')
61 69
62 _CHROME_BIN_PATH = os.path.join(perf.BasePerfTest.BrowserPath(), 'chrome') 70 _CHROME_BIN_PATH = os.path.join(perf.BasePerfTest.BrowserPath(), 'chrome')
63 71
64 def setUp(self): 72 def setUp(self):
73 # Parse the environment variable for the usage of Web Page Replay.
74 # It must be parsed before perf.BasePerfTest.setUp()
slamm_google 2012/08/07 20:00:43 Better? # The Web Page Replay environment variabl
fdeng 2012/08/07 21:24:19 Done.
75 self._ParseReplayEnv()
65 # The environment variables for the Deep Memory Profiler must be set 76 # The environment variables for the Deep Memory Profiler must be set
66 # before perf.BasePerfTest.setUp() to inherit them to Chrome. 77 # before perf.BasePerfTest.setUp() to inherit them to Chrome.
67 self._deep_memory_profile = self._GetDeepMemoryProfileEnv( 78 self._deep_memory_profile = self._GetDeepMemoryProfileEnv(
68 'DEEP_MEMORY_PROFILE', bool, self._DEEP_MEMORY_PROFILE) 79 'DEEP_MEMORY_PROFILE', bool, self._DEEP_MEMORY_PROFILE)
69 80
70 self._deep_memory_profile_interval = self._GetDeepMemoryProfileEnv( 81 self._deep_memory_profile_interval = self._GetDeepMemoryProfileEnv(
71 'DEEP_MEMORY_PROFILE_INTERVAL', int, self._DEEP_MEMORY_PROFILE_INTERVAL) 82 'DEEP_MEMORY_PROFILE_INTERVAL', int, self._DEEP_MEMORY_PROFILE_INTERVAL)
72 83
73 if self._deep_memory_profile: 84 if self._deep_memory_profile:
74 if not self.IsLinux(): 85 if not self.IsLinux():
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 self._remote_inspector_client = ( 121 self._remote_inspector_client = (
111 remote_inspector_client.RemoteInspectorClient()) 122 remote_inspector_client.RemoteInspectorClient())
112 logging.info('Connection to remote inspector set up successfully.') 123 logging.info('Connection to remote inspector set up successfully.')
113 124
114 self._test_start_time = 0 125 self._test_start_time = 0
115 self._num_errors = 0 126 self._num_errors = 0
116 self._events_to_output = [] 127 self._events_to_output = []
117 self._deep_memory_profile_json_file = None 128 self._deep_memory_profile_json_file = None
118 self._deep_memory_profile_last_json_filename = '' 129 self._deep_memory_profile_last_json_filename = ''
119 self._deep_memory_profile_proc = None 130 self._deep_memory_profile_proc = None
131 self._StartReplayServerIfNecessary()
120 132
121 def tearDown(self): 133 def tearDown(self):
122 logging.info('Terminating connection to remote inspector...') 134 logging.info('Terminating connection to remote inspector...')
123 self._remote_inspector_client.Stop() 135 self._remote_inspector_client.Stop()
124 logging.info('Connection to remote inspector terminated.') 136 logging.info('Connection to remote inspector terminated.')
125 if self._deep_memory_profile: 137 if self._deep_memory_profile:
126 # TODO(dmikurube): Stop to set HEAP_PROFILE_TIME_INTERVAL in setUp when 138 # TODO(dmikurube): Stop to set HEAP_PROFILE_TIME_INTERVAL in setUp when
127 # PyAuto supports to dump renderer heap profile. 139 # PyAuto supports to dump renderer heap profile.
128 del os.environ['HEAP_PROFILE_TIME_INTERVAL'] 140 del os.environ['HEAP_PROFILE_TIME_INTERVAL']
129 del os.environ['DEEP_HEAP_PROFILE'] 141 del os.environ['DEEP_HEAP_PROFILE']
130 del os.environ['HEAP_PROFILE_MMAP'] 142 del os.environ['HEAP_PROFILE_MMAP']
131 del os.environ['HEAPPROFILE'] 143 del os.environ['HEAPPROFILE']
132 144
133 # Must be done at end of this function except for post-cleaning after 145 # Must be done at end of this function except for post-cleaning after
134 # Chrome finishes. 146 # Chrome finishes.
135 perf.BasePerfTest.tearDown(self) 147 perf.BasePerfTest.tearDown(self)
136 148
137 # Remove the temporary directory after Chrome finishes in tearDown. 149 # Remove the temporary directory after Chrome finishes in tearDown.
138 if (self._deep_memory_profile and 150 if (self._deep_memory_profile and
139 not self._deep_memory_profile_save and 151 not self._deep_memory_profile_save and
140 self._deep_tempdir): 152 self._deep_tempdir):
141 pyauto_utils.RemovePath(self._deep_tempdir) 153 pyauto_utils.RemovePath(self._deep_tempdir)
154 # Must be done after perf.BasePerfTest.tearDown()
155 self._StopReplayServerIfNecessary()
156
157 def _GetArchiveName(self):
158 """Return the Web Page Replay archive name that corresponds to a test.
159
160 Override this function to return the name of an archive that
161 corresponds to the test, e.g "ChromeEndureGmailTest.wpr".
162
163 Returns:
164 None, by default no archive name is provided.
165 """
166 return None
167
168 def _ParseReplayEnv(self):
169 """Parse Web Page Replay related envrionment variables."""
170 if 'ENDURE_NO_WPR' in os.environ:
171 self._use_wpr = False
172 logging.info('Skipping Web Page Replay since ENDURE_NO_WPR is set.')
173 else:
174 self._archive_path = None
175 if 'WPR_ARCHIVE_PATH' in os.environ:
176 self._archive_path = os.environ.get('WPR_ARCHIVE_PATH')
177 else:
178 if self._GetArchiveName():
179 self._archive_path = ChromeEndureReplay.Path(
180 'archive', archive_name=self._GetArchiveName())
181 self._is_record_mode = 'WPR_RECORD' in os.environ
182 if self._is_record_mode:
183 if self._archive_path:
184 self._use_wpr = True
fdeng1 2012/08/07 02:56:57 In record mode, we just need an valid archive file
185 else:
186 self._use_wpr = False
187 logging.info('Fail to record since a valid archive path can not ' +
188 'be generated. Did you implement ' +
189 '_GetArchiveName() in your test?')
190 else:
191 if self._archive_path and os.path.exists(self._archive_path):
192 self._use_wpr = True
fdeng1 2012/08/07 02:56:57 In replay mode, we need an valid archive file path
193 else:
194 self._use_wpr = False
195 logging.info(
196 'Skipping Web Page Replay since archive file %sdoes not exist.',
197 self._archive_path+' ' if self._archive_path else '')
dennis_jeffrey 2012/08/07 19:42:09 add a space right before and right after the +
fdeng 2012/08/07 21:24:19 Done.
142 198
143 def _GetDeepMemoryProfileEnv(self, env_name, converter, default): 199 def _GetDeepMemoryProfileEnv(self, env_name, converter, default):
144 """Returns a converted environment variable for the Deep Memory Profiler. 200 """Returns a converted environment variable for the Deep Memory Profiler.
145 201
146 Args: 202 Args:
147 env_name: A string name of an environment variable. 203 env_name: A string name of an environment variable.
148 converter: A function taking a string to convert an environment variable. 204 converter: A function taking a string to convert an environment variable.
149 default: A value used if the environment variable is not specified. 205 default: A value used if the environment variable is not specified.
150 206
151 Returns: 207 Returns:
(...skipping 21 matching lines...) Expand all
173 # The same with setUp, but need to fetch the environment variable since 229 # The same with setUp, but need to fetch the environment variable since
174 # ExtraChromeFlags is called before setUp. 230 # ExtraChromeFlags is called before setUp.
175 deep_memory_profile = self._GetDeepMemoryProfileEnv( 231 deep_memory_profile = self._GetDeepMemoryProfileEnv(
176 'DEEP_MEMORY_PROFILE', bool, self._DEEP_MEMORY_PROFILE) 232 'DEEP_MEMORY_PROFILE', bool, self._DEEP_MEMORY_PROFILE)
177 233
178 # Ensure Chrome enables remote debugging on port 9222. This is required to 234 # Ensure Chrome enables remote debugging on port 9222. This is required to
179 # interact with Chrome's remote inspector. 235 # interact with Chrome's remote inspector.
180 extra_flags = ['--remote-debugging-port=9222'] 236 extra_flags = ['--remote-debugging-port=9222']
181 if deep_memory_profile: 237 if deep_memory_profile:
182 extra_flags.append('--no-sandbox') 238 extra_flags.append('--no-sandbox')
183 return (perf.BasePerfTest.ExtraChromeFlags(self) + extra_flags) 239 if self._use_wpr:
240 extra_flags.extend(ChromeEndureReplay.CHROME_FLAGS)
241 return perf.BasePerfTest.ExtraChromeFlags(self) + extra_flags
184 242
185 def _OnTimelineEvent(self, event_info): 243 def _OnTimelineEvent(self, event_info):
186 """Invoked by the Remote Inspector Client when a timeline event occurs. 244 """Invoked by the Remote Inspector Client when a timeline event occurs.
187 245
188 Args: 246 Args:
189 event_info: A dictionary containing raw information associated with a 247 event_info: A dictionary containing raw information associated with a
190 timeline event received from Chrome's remote inspector. Refer to 248 timeline event received from Chrome's remote inspector. Refer to
191 chrome/src/third_party/WebKit/Source/WebCore/inspector/Inspector.json 249 chrome/src/third_party/WebKit/Source/WebCore/inspector/Inspector.json
192 for the format of this dictionary. 250 for the format of this dictionary.
193 """ 251 """
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 try: 591 try:
534 element = self._GetElement(driver.find_element_by_xpath, xpath) 592 element = self._GetElement(driver.find_element_by_xpath, xpath)
535 element.click() 593 element.click()
536 except (selenium.common.exceptions.StaleElementReferenceException, 594 except (selenium.common.exceptions.StaleElementReferenceException,
537 selenium.common.exceptions.TimeoutException) as e: 595 selenium.common.exceptions.TimeoutException) as e:
538 logging.exception('WebDriver exception: %s' % e) 596 logging.exception('WebDriver exception: %s' % e)
539 return False 597 return False
540 598
541 return True 599 return True
542 600
601 def _StartReplayServerIfNecessary(self):
602 """Start replay server if necessary.
603
604 This method needs to be called BEFORE any connection (which is supposed
605 to go through the Web Page Replay server) occurs.
slamm_google 2012/08/07 20:00:43 Does this need to be said?
fdeng 2012/08/07 21:24:19 Deleted. On 2012/08/07 20:00:43, slamm wrote:
606 """
607 if self._use_wpr:
608 mode = 'record' if self._is_record_mode else 'replay'
609 self._wpr_server = ChromeEndureReplay.ReplayServer(self._archive_path)
610 self._wpr_server.StartServer()
611 logging.info('Web Page Replay server has started in %s mode.', mode)
612
613 def _StopReplayServerIfNecessary(self):
614 """Stop the Web Page Replay server if necessary.
615
616 This method has to be called AFTER all network connections which go
617 through Web Page Replay server have shut down. Otherwise the
618 Web Page Replay server will hang to wait for them. A good
619 place is to call it at the end of the teardown process.
620 """
621 if self._use_wpr:
622 self._wpr_server.StopServer()
623 logging.info('The Web Page Replay server stopped.')
624
543 625
544 class ChromeEndureControlTest(ChromeEndureBaseTest): 626 class ChromeEndureControlTest(ChromeEndureBaseTest):
545 """Control tests for Chrome Endure.""" 627 """Control tests for Chrome Endure."""
546 628
547 _WEBAPP_NAME = 'Control' 629 _WEBAPP_NAME = 'Control'
548 _TAB_TITLE_SUBSTRING = 'Chrome Endure Control Test' 630 _TAB_TITLE_SUBSTRING = 'Chrome Endure Control Test'
549 631
550 def testControlAttachDetachDOMTree(self): 632 def testControlAttachDetachDOMTree(self):
551 """Continually attach and detach a DOM tree from a basic document.""" 633 """Continually attach and detach a DOM tree from a basic document."""
552 test_description = 'AttachDetachDOMTree' 634 test_description = 'AttachDetachDOMTree'
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 698
617 # Wait until Gmail's 'canvas_frame' loads and the 'Inbox' link is present. 699 # Wait until Gmail's 'canvas_frame' loads and the 'Inbox' link is present.
618 # TODO(dennisjeffrey): Check with the Gmail team to see if there's a better 700 # TODO(dennisjeffrey): Check with the Gmail team to see if there's a better
619 # way to tell when the webpage is ready for user interaction. 701 # way to tell when the webpage is ready for user interaction.
620 self._wait.until( 702 self._wait.until(
621 self._SwitchToCanvasFrame) # Raises exception if the timeout is hit. 703 self._SwitchToCanvasFrame) # Raises exception if the timeout is hit.
622 # Wait for the inbox to appear. 704 # Wait for the inbox to appear.
623 self.WaitForDomNode('//a[starts-with(@title, "Inbox")]', 705 self.WaitForDomNode('//a[starts-with(@title, "Inbox")]',
624 frame_xpath=self._FRAME_XPATH) 706 frame_xpath=self._FRAME_XPATH)
625 707
708 def _GetArchiveName(self):
709 """Return Web Page Replay archive name."""
710 return 'ChromeEndureGmailTest.wpr'
711
626 def _SwitchToCanvasFrame(self, driver): 712 def _SwitchToCanvasFrame(self, driver):
627 """Switch the WebDriver to Gmail's 'canvas_frame', if it's available. 713 """Switch the WebDriver to Gmail's 'canvas_frame', if it's available.
628 714
629 Args: 715 Args:
630 driver: A selenium.webdriver.remote.webdriver.WebDriver object. 716 driver: A selenium.webdriver.remote.webdriver.WebDriver object.
631 717
632 Returns: 718 Returns:
633 True, if the switch to Gmail's 'canvas_frame' is successful, or 719 True, if the switch to Gmail's 'canvas_frame' is successful, or
634 False if not. 720 False if not.
635 """ 721 """
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 self.NavigateToURL('http://docs.google.com') 1029 self.NavigateToURL('http://docs.google.com')
944 self.assertTrue( 1030 self.assertTrue(
945 self.WaitUntil(lambda: self._TAB_TITLE_SUBSTRING in 1031 self.WaitUntil(lambda: self._TAB_TITLE_SUBSTRING in
946 self.GetActiveTabTitle(), 1032 self.GetActiveTabTitle(),
947 timeout=60, expect_retval=True, retry_sleep=1), 1033 timeout=60, expect_retval=True, retry_sleep=1),
948 msg='Timed out waiting for Docs to load. Tab title is: %s' % 1034 msg='Timed out waiting for Docs to load. Tab title is: %s' %
949 self.GetActiveTabTitle()) 1035 self.GetActiveTabTitle())
950 1036
951 self._driver = self.NewWebDriver() 1037 self._driver = self.NewWebDriver()
952 1038
1039 def _GetArchiveName(self):
1040 """Return Web Page Replay archive name."""
1041 return 'ChromeEndureDocsTest.wpr'
1042
953 def testDocsAlternatelyClickLists(self): 1043 def testDocsAlternatelyClickLists(self):
954 """Alternates between two different document lists. 1044 """Alternates between two different document lists.
955 1045
956 This test alternately clicks the "Shared with me" and "My Drive" buttons in 1046 This test alternately clicks the "Shared with me" and "My Drive" buttons in
957 Google Docs, and periodically gathers performance stats that may reveal 1047 Google Docs, and periodically gathers performance stats that may reveal
958 memory bloat. 1048 memory bloat.
959 """ 1049 """
960 test_description = 'AlternateLists' 1050 test_description = 'AlternateLists'
961 1051
962 def sort_menu_setup(): 1052 def sort_menu_setup():
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 # Log into a test Google account and open up Google Plus. 1103 # Log into a test Google account and open up Google Plus.
1014 self._LoginToGoogleAccount() 1104 self._LoginToGoogleAccount()
1015 self.NavigateToURL('http://plus.google.com') 1105 self.NavigateToURL('http://plus.google.com')
1016 loaded_tab_title = self.GetActiveTabTitle() 1106 loaded_tab_title = self.GetActiveTabTitle()
1017 self.assertTrue(self._TAB_TITLE_SUBSTRING in loaded_tab_title, 1107 self.assertTrue(self._TAB_TITLE_SUBSTRING in loaded_tab_title,
1018 msg='Loaded tab title does not contain "%s": "%s"' % 1108 msg='Loaded tab title does not contain "%s": "%s"' %
1019 (self._TAB_TITLE_SUBSTRING, loaded_tab_title)) 1109 (self._TAB_TITLE_SUBSTRING, loaded_tab_title))
1020 1110
1021 self._driver = self.NewWebDriver() 1111 self._driver = self.NewWebDriver()
1022 1112
1113 def _GetArchiveName(self):
1114 """Return Web Page Replay archive name."""
1115 return 'ChromeEndurePlusTest.wpr'
1116
1023 def testPlusAlternatelyClickStreams(self): 1117 def testPlusAlternatelyClickStreams(self):
1024 """Alternates between two different streams. 1118 """Alternates between two different streams.
1025 1119
1026 This test alternately clicks the "Friends" and "Family" buttons using 1120 This test alternately clicks the "Friends" and "Family" buttons using
1027 Google Plus, and periodically gathers performance stats that may reveal 1121 Google Plus, and periodically gathers performance stats that may reveal
1028 memory bloat. 1122 memory bloat.
1029 """ 1123 """
1030 test_description = 'AlternateStreams' 1124 test_description = 'AlternateStreams'
1031 1125
1032 def scenario(): 1126 def scenario():
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 except (pyauto_errors.JSONInterfaceError, 1210 except (pyauto_errors.JSONInterfaceError,
1117 pyauto_errors.JavascriptRuntimeError): 1211 pyauto_errors.JavascriptRuntimeError):
1118 self._num_errors += 1 1212 self._num_errors += 1
1119 1213
1120 time.sleep(1) 1214 time.sleep(1)
1121 1215
1122 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING, 1216 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING,
1123 test_description, scenario) 1217 test_description, scenario)
1124 1218
1125 1219
1220 class ChromeEndureReplay(object):
1221 """Run Chrome Endure tests with network simulation via Web Page Replay."""
1222
1223 _PATHS = {
1224 'archive':
1225 'src/chrome/test/data/pyauto_private/webpagereplay/{archive_name}',
1226 'scripts':
1227 'src/chrome/test/data/chrome_endure/webpagereplay/wpr_deterministic.js',
1228 }
1229 CHROME_FLAGS = webpagereplay.CHROME_FLAGS
1230
1231 @classmethod
1232 def Path(cls, key, **kwargs):
1233 return perf.FormatChromePath(cls._PATHS[key], **kwargs)
1234
1235 @classmethod
1236 def ReplayServer(cls, archive_path):
1237 """Creat a replay server."""
slamm_google 2012/08/07 20:00:43 Creat -> Create
fdeng 2012/08/07 21:24:19 Done.
1238 # Inject customized scripts for Google webapps.
1239 # See the javascript file for details.
1240 scripts = cls.Path('scripts')
1241 if not os.path.exists(scripts):
1242 raise webpagereplay.ReplayNotFoundError('injected scripts', scripts)
slamm_google 2012/08/07 20:00:43 Instead of using a custom exception from webpagere
fdeng 2012/08/07 21:24:19 Change to IOError On 2012/08/07 20:00:43, slamm wr
1243 replay_options = ['--inject_scripts', scripts]
1244 if 'WPR_RECORD' in os.environ:
1245 replay_options.append('--append')
1246 return webpagereplay.ReplayServer(archive_path, replay_options)
1247
1248
1126 if __name__ == '__main__': 1249 if __name__ == '__main__':
1127 pyauto_functional.Main() 1250 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/data/chrome_endure/webpagereplay/wpr_deterministic.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698