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

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

Issue 10834239: Configuration file for Chrome perf and endure tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Dennis 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 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 fed79f499f00ed363d487cb579e2d3ff11c9f4d2..fbd131115dc2d076f4b8a1a8b54f39c1f7d9ddf3 100755
--- a/chrome/test/functional/perf_endure.py
+++ b/chrome/test/functional/perf_endure.py
@@ -602,11 +602,13 @@ class ChromeEndureGmailTest(ChromeEndureBaseTest):
# Log into a test Google account and open up Gmail.
self._LoginToGoogleAccount(account_key='test_google_account_gmail')
- self.NavigateToURL('http://www.gmail.com')
- 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))
+ self.NavigateToURL(self._GetConfig().get('gmail_url'))
+ self.assertTrue(
+ self.WaitUntil(lambda: self._TAB_TITLE_SUBSTRING in
+ self.GetActiveTabTitle(),
+ timeout=60, expect_retval=True, retry_sleep=1),
+ msg='Timed out waiting for Gmail to load. Tab title is: %s' %
+ self.GetActiveTabTitle())
self._driver = self.NewWebDriver()
# Any call to wait.until() will raise an exception if the timeout is hit.
@@ -622,6 +624,14 @@ class ChromeEndureGmailTest(ChromeEndureBaseTest):
# Wait for the inbox to appear.
self.WaitForDomNode('//a[starts-with(@title, "Inbox")]',
frame_xpath=self._FRAME_XPATH)
+ # Test whether latency dom element is available.
dennis_jeffrey 2012/08/17 17:35:44 nit: add a blank line above this to separate the l
fdeng1 2012/08/17 23:19:37 Done.
+ try:
+ self._GetLatencyDomElement(3000)
+ self._has_latency = True
+ except pyauto_errors.JSONInterfaceError:
+ logging.info('Skip recording latency as latency ' +
+ 'dom element is not available.')
+ self._has_latency = False
def _SwitchToCanvasFrame(self, driver):
"""Switch the WebDriver to Gmail's 'canvas_frame', if it's available.
@@ -639,11 +649,19 @@ class ChromeEndureGmailTest(ChromeEndureBaseTest):
except selenium.common.exceptions.NoSuchFrameException:
return False
- def _GetLatencyDomElement(self):
- """Returns a reference to the latency info element in the Gmail DOM."""
+ def _GetLatencyDomElement(self, timeout=-1):
+ """Returns a reference to the latency info element in the Gmail DOM.
+
+ Args:
+ timeout: The maximum amount of time (in milliseconds) to wait for
+ the latency dom element to appear.
dennis_jeffrey 2012/08/17 17:35:44 describe what happens with the default value of -1
fdeng1 2012/08/17 23:19:37 Done.
+ Returns:
+ A latency dom element.
+ """
latency_xpath = (
'//span[starts-with(text(), "Why was the last action slow?")]')
- self.WaitForDomNode(latency_xpath, frame_xpath=self._FRAME_XPATH)
+ self.WaitForDomNode(latency_xpath, timeout=timeout,
+ frame_xpath=self._FRAME_XPATH)
return self._GetElement(self._driver.find_element_by_xpath, latency_xpath)
def _WaitUntilDomElementRemoved(self, dom_element):
@@ -676,6 +694,9 @@ class ChromeEndureGmailTest(ChromeEndureBaseTest):
action_description: A string description of what action is being
performed. Should not contain spaces. For example, 'Compose'.
"""
+ if not self._has_latency:
+ element.click()
+ return
latency_dom_element = self._GetLatencyDomElement()
element.click()
# Wait for the old latency value to be removed, before getting the new one.
@@ -940,7 +961,7 @@ class ChromeEndureDocsTest(ChromeEndureBaseTest):
# Log into a test Google account and open up Google Docs.
self._LoginToGoogleAccount()
- self.NavigateToURL('http://docs.google.com')
+ self.NavigateToURL(self._GetConfig().get('docs_url'))
self.assertTrue(
self.WaitUntil(lambda: self._TAB_TITLE_SUBSTRING in
self.GetActiveTabTitle(),
@@ -1012,7 +1033,7 @@ class ChromeEndurePlusTest(ChromeEndureBaseTest):
# Log into a test Google account and open up Google Plus.
self._LoginToGoogleAccount()
- self.NavigateToURL('http://plus.google.com')
+ self.NavigateToURL(self._GetConfig().get('plus_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"' %

Powered by Google App Engine
This is Rietveld 408576698