Chromium Code Reviews| 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.""" |