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

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

Issue 10372002: Chrome Endure Gmail test ComposeDiscardSleep has a new sleeping pattern. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | « no previous file | 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
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 example, 'ComposeDiscard' for Gmail. 109 example, 'ComposeDiscard' for Gmail.
110 do_scenario: A callable to be invoked that implements the scenario to be 110 do_scenario: A callable to be invoked that implements the scenario to be
111 performed by this test. The callable is invoked iteratively for the 111 performed by this test. The callable is invoked iteratively for the
112 duration of the test. 112 duration of the test.
113 """ 113 """
114 self._num_errors = 0 114 self._num_errors = 0
115 self._test_start_time = time.time() 115 self._test_start_time = time.time()
116 last_perf_stats_time = time.time() 116 last_perf_stats_time = time.time()
117 self._GetPerformanceStats( 117 self._GetPerformanceStats(
118 webapp_name, test_description, tab_title_substring) 118 webapp_name, test_description, tab_title_substring)
119 iteration_num = 0 119 self._iteration_num = 0 # Available to |do_scenario| if needed.
120 120
121 self._remote_inspector_client.StartTimelineEventMonitoring( 121 self._remote_inspector_client.StartTimelineEventMonitoring(
122 self._OnTimelineEvent) 122 self._OnTimelineEvent)
123 123
124 while time.time() - self._test_start_time < self._test_length_sec: 124 while time.time() - self._test_start_time < self._test_length_sec:
125 iteration_num += 1 125 self._iteration_num += 1
126 126
127 if self._num_errors >= self._ERROR_COUNT_THRESHOLD: 127 if self._num_errors >= self._ERROR_COUNT_THRESHOLD:
128 logging.error('Error count threshold (%d) reached. Terminating test ' 128 logging.error('Error count threshold (%d) reached. Terminating test '
129 'early.' % self._ERROR_COUNT_THRESHOLD) 129 'early.' % self._ERROR_COUNT_THRESHOLD)
130 break 130 break
131 131
132 if time.time() - last_perf_stats_time >= self._get_perf_stats_interval: 132 if time.time() - last_perf_stats_time >= self._get_perf_stats_interval:
133 last_perf_stats_time = time.time() 133 last_perf_stats_time = time.time()
134 self._GetPerformanceStats( 134 self._GetPerformanceStats(
135 webapp_name, test_description, tab_title_substring) 135 webapp_name, test_description, tab_title_substring)
136 136
137 if iteration_num % 10 == 0: 137 if self._iteration_num % 10 == 0:
138 remaining_time = self._test_length_sec - (time.time() - 138 remaining_time = self._test_length_sec - (time.time() -
139 self._test_start_time) 139 self._test_start_time)
140 logging.info('Chrome interaction #%d. Time remaining in test: %d sec.' % 140 logging.info('Chrome interaction #%d. Time remaining in test: %d sec.' %
141 (iteration_num, remaining_time)) 141 (self._iteration_num, remaining_time))
142 142
143 do_scenario() 143 do_scenario()
144 144
145 self._remote_inspector_client.StopTimelineEventMonitoring() 145 self._remote_inspector_client.StopTimelineEventMonitoring()
146 self._GetPerformanceStats( 146 self._GetPerformanceStats(
147 webapp_name, test_description, tab_title_substring) 147 webapp_name, test_description, tab_title_substring)
148 148
149 def _GetProcessInfo(self, tab_title_substring): 149 def _GetProcessInfo(self, tab_title_substring):
150 """Gets process info associated with an open browser/tab. 150 """Gets process info associated with an open browser/tab.
151 151
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 discard_button = self._wait.until(lambda _: self._GetElement( 562 discard_button = self._wait.until(lambda _: self._GetElement(
563 self._driver.find_element_by_xpath, 563 self._driver.find_element_by_xpath,
564 '//div[text()="Discard"]')) 564 '//div[text()="Discard"]'))
565 discard_button.click() 565 discard_button.click()
566 566
567 # Wait for the message to be discarded, assumed to be true after the 567 # Wait for the message to be discarded, assumed to be true after the
568 # "To" field is removed from the webpage DOM. 568 # "To" field is removed from the webpage DOM.
569 self._wait.until(lambda _: not self._GetElement( 569 self._wait.until(lambda _: not self._GetElement(
570 self._driver.find_element_by_name, 'to')) 570 self._driver.find_element_by_name, 'to'))
571 571
572 logging.debug('Sleeping 30 seconds.') 572 # Sleep 2 minutes after every batch of 500 compose/discard iterations.
573 time.sleep(30) 573 if self._iteration_num % 500 == 0:
574 logging.info('Sleeping 2 minutes.')
575 time.sleep(120)
574 576
575 self._RunEndureTest(self._webapp_name, self._tab_title_substring, 577 self._RunEndureTest(self._webapp_name, self._tab_title_substring,
576 test_description, scenario) 578 test_description, scenario)
577 579
578 def testGmailAlternateThreadlistConversation(self): 580 def testGmailAlternateThreadlistConversation(self):
579 """Alternates between threadlist view and conversation view. 581 """Alternates between threadlist view and conversation view.
580 582
581 This test continually clicks between the threadlist (Inbox) and the 583 This test continually clicks between the threadlist (Inbox) and the
582 conversation view (e-mail message view), and periodically gathers 584 conversation view (e-mail message view), and periodically gathers
583 performance stats that may reveal memory bloat. 585 performance stats that may reveal memory bloat.
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 self._driver, self._wait, 'id("state")[text()="offline"]'): 877 self._driver, self._wait, 'id("state")[text()="offline"]'):
876 self._num_errors += 1 878 self._num_errors += 1
877 time.sleep(1) 879 time.sleep(1)
878 880
879 self._RunEndureTest(self._webapp_name, self._tab_title_substring, 881 self._RunEndureTest(self._webapp_name, self._tab_title_substring,
880 test_description, scenario) 882 test_description, scenario)
881 883
882 884
883 if __name__ == '__main__': 885 if __name__ == '__main__':
884 pyauto_functional.Main() 886 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698