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

Unified Diff: chrome/test/functional/perf_endure.py

Issue 9687001: Adding another control test for Chrome Endure that uses WebDriver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adjusted indentation of several lines. Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/chrome_endure/endurance_control_webdriver.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/perf_endure.py
diff --git a/chrome/test/functional/perf_endure.py b/chrome/test/functional/perf_endure.py
index bad91e102eeeacbdf0952fb3de7f273fb06cd4b3..2381ea838747e68ebf4c990158a896c02cfce6a9 100644
--- a/chrome/test/functional/perf_endure.py
+++ b/chrome/test/functional/perf_endure.py
@@ -250,20 +250,19 @@ class ChromeEndureControlTest(ChromeEndureBaseTest):
_webapp_name = 'Control'
_tab_title_substring = 'Chrome Endure Control Test'
- def testControlAttachDetachDOMTree(self):
- """Continually attach and detach a DOM tree from a basic document."""
- test_description = 'AttachDetachDOMTree'
-
- url = self.GetHttpURLForDataPath('chrome_endure', 'endurance_control.html')
- self.NavigateToURL(url)
+ # TODO(dennisjeffrey): Make this function available to the other Chrome Endure
+ # tests so that we can remove duplicated code in those other tests as well.
+ # Ideally, tests shouldn't have knowledge about the details of how the test
+ # harness runs; the only main difference between the tests is that they
+ # navigate to different URLs, and perform different scenarios on them.
+ def _RunControlTest(self, test_description, data_file_url, do_scenario):
+ """Runs a general control test."""
+ self.NavigateToURL(data_file_url)
loaded_tab_title = self.GetActiveTabTitle()
self.assertTrue(self._tab_title_substring in loaded_tab_title,
msg='Loaded tab title does not contain "%s": "%s"' %
(self._tab_title_substring, loaded_tab_title))
- # This test performs no interaction with the webpage. It simply sleeps
- # and periodically checks to see whether it's time to take performance
- # measurements.
self._test_start_time = time.time()
last_perf_stats_time = time.time()
self._GetPerformanceStats(self._webapp_name, test_description,
@@ -278,16 +277,52 @@ class ChromeEndureControlTest(ChromeEndureBaseTest):
self._tab_title_substring)
if iteration_num % 10 == 0:
- remaining_time = self._test_length_sec - (
- time.time() - self._test_start_time)
+ remaining_time = self._test_length_sec - (time.time() -
+ self._test_start_time)
logging.info('Chrome interaction #%d. Time remaining in test: %d sec.' %
(iteration_num, remaining_time))
- time.sleep(5)
+ do_scenario()
self._GetPerformanceStats(self._webapp_name, test_description,
self._tab_title_substring)
+ def testControlAttachDetachDOMTree(self):
+ """Continually attach and detach a DOM tree from a basic document."""
+ test_description = 'AttachDetachDOMTree'
+ url = self.GetHttpURLForDataPath('chrome_endure', 'endurance_control.html')
+
+ def scenario():
+ # This test performs no interaction with the webpage. It simply sleeps
+ # and periodically checks to see whether it's time to take performance
+ # measurements.
+ time.sleep(5)
+
+ self._RunControlTest(test_description, url, scenario)
+
+
+ def testControlAttachDetachDOMTreeWebDriver(self):
+ """Use WebDriver to attach and detach a DOM tree from a basic document."""
+ test_description = 'AttachDetachDOMTreeWebDriver'
+ url = self.GetHttpURLForDataPath('chrome_endure',
+ 'endurance_control_webdriver.html')
+
+ driver = self.NewWebDriver()
+ wait = WebDriverWait(driver, timeout=60)
+
+ def scenario(driver, wait):
+ # Interact with the control test webpage for the duration of the test.
+ # Here, we repeat the following sequence of interactions: click the
+ # "attach" button to attach a large DOM tree (with event listeners) to the
+ # document, wait half a second, click "detach" to detach the DOM tree from
+ # the document, wait half a second.
+ self._ClickElementByXpath(driver, wait, 'id("attach")')
+ time.sleep(0.5)
+ self._ClickElementByXpath(driver, wait, 'id("detach")')
+ time.sleep(0.5)
+
+ self._RunControlTest(test_description, url, lambda: scenario(driver, wait))
+
class ChromeEndureGmailTest(ChromeEndureBaseTest):
"""Long-running performance tests for Chrome using Gmail."""
@@ -362,8 +397,8 @@ class ChromeEndureGmailTest(ChromeEndureBaseTest):
self._tab_title_substring)
if iteration_num % 10 == 0:
- remaining_time = self._test_length_sec - (
- time.time() - self._test_start_time)
+ remaining_time = self._test_length_sec - (time.time() -
+ self._test_start_time)
logging.info('Chrome interaction #%d. Time remaining in test: %d sec.' %
(iteration_num, remaining_time))
@@ -422,8 +457,8 @@ class ChromeEndureGmailTest(ChromeEndureBaseTest):
self._tab_title_substring)
if iteration_num % 10 == 0:
- remaining_time = self._test_length_sec - (
- time.time() - self._test_start_time)
+ remaining_time = self._test_length_sec - (time.time() -
+ self._test_start_time)
logging.info('Chrome interaction #%d. Time remaining in test: %d sec.' %
(iteration_num, remaining_time))
@@ -483,8 +518,8 @@ class ChromeEndureGmailTest(ChromeEndureBaseTest):
self._tab_title_substring)
if iteration_num % 10 == 0:
- remaining_time = self._test_length_sec - (
- time.time() - self._test_start_time)
+ remaining_time = self._test_length_sec - (time.time() -
+ self._test_start_time)
logging.info('Chrome interaction #%d. Time remaining in test: %d sec.' %
(iteration_num, remaining_time))
@@ -541,8 +576,8 @@ class ChromeEndureGmailTest(ChromeEndureBaseTest):
self._tab_title_substring)
if iteration_num % 10 == 0:
- remaining_time = self._test_length_sec - (
- time.time() - self._test_start_time)
+ remaining_time = self._test_length_sec - (time.time() -
+ self._test_start_time)
logging.info('Chrome interaction #%d. Time remaining in test: %d sec.' %
(iteration_num, remaining_time))
@@ -608,8 +643,8 @@ class ChromeEndureGmailTest(ChromeEndureBaseTest):
self._tab_title_substring)
if iteration_num % 10 == 0:
- remaining_time = self._test_length_sec - (
- time.time() - self._test_start_time)
+ remaining_time = self._test_length_sec - (time.time() -
+ self._test_start_time)
logging.info('Chrome interaction #%d. Time remaining in test: %d sec.' %
(iteration_num, remaining_time))
@@ -695,8 +730,8 @@ class ChromeEndureDocsTest(ChromeEndureBaseTest):
self._tab_title_substring)
if iteration_num % 10 == 0:
- remaining_time = self._test_length_sec - (
- time.time() - self._test_start_time)
+ remaining_time = self._test_length_sec - (time.time() -
+ self._test_start_time)
logging.info('Chrome interaction #%d. Time remaining in test: %d sec.' %
(iteration_num, remaining_time))
@@ -774,8 +809,8 @@ class ChromeEndurePlusTest(ChromeEndureBaseTest):
self._tab_title_substring)
if iteration_num % 10 == 0:
- remaining_time = self._test_length_sec - (
- time.time() - self._test_start_time)
+ remaining_time = self._test_length_sec - (time.time() -
+ self._test_start_time)
logging.info('Chrome interaction #%d. Time remaining in test: %d sec.' %
(iteration_num, remaining_time))
« no previous file with comments | « chrome/test/data/chrome_endure/endurance_control_webdriver.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698