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

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: 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
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..340d942539b6a9ef81dcdc2ba901440235a95a42 100644
--- a/chrome/test/functional/perf_endure.py
+++ b/chrome/test/functional/perf_endure.py
@@ -288,6 +288,53 @@ class ChromeEndureControlTest(ChromeEndureBaseTest):
self._GetPerformanceStats(self._webapp_name, test_description,
self._tab_title_substring)
+ def testControlAttachDetachDOMTreeWebDriver(self):
frankf1 2012/03/10 02:57:17 There are a lot of duplication between this and pr
dennis_jeffrey 2012/03/12 18:48:07 Good point. Done. Also added a TODO to make the
+ """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')
+ self.NavigateToURL(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))
+
+ driver = self.NewWebDriver()
+ wait = WebDriverWait(driver, timeout=60)
+
+ # 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._test_start_time = time.time()
+ last_perf_stats_time = time.time()
+ self._GetPerformanceStats(self._webapp_name, test_description,
+ self._tab_title_substring)
+ iteration_num = 0
+ while time.time() - self._test_start_time < self._test_length_sec:
+ iteration_num += 1
+
+ if time.time() - last_perf_stats_time >= self._get_perf_stats_interval:
+ last_perf_stats_time = time.time()
+ self._GetPerformanceStats(self._webapp_name, test_description,
+ self._tab_title_substring)
+
+ if iteration_num % 10 == 0:
+ remaining_time = self._test_length_sec - (
+ time.time() - self._test_start_time)
frankf1 2012/03/10 02:57:17 alignment issue
dennis_jeffrey 2012/03/12 18:48:07 I indented this line 4 spaces underneath the right
+ logging.info('Chrome interaction #%d. Time remaining in test: %d sec.' %
+ (iteration_num, remaining_time))
+
+ self._ClickElementByXpath(driver, wait, 'id("attach")')
+ time.sleep(0.5)
+ self._ClickElementByXpath(driver, wait, 'id("detach")')
+ time.sleep(0.5)
+
+ self._GetPerformanceStats(self._webapp_name, test_description,
+ self._tab_title_substring)
+
class ChromeEndureGmailTest(ChromeEndureBaseTest):
"""Long-running performance tests for Chrome using Gmail."""

Powered by Google App Engine
This is Rietveld 408576698