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

Side by Side 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 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 unified diff | Download patch | Annotate | Revision Log
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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 595
596 _WEBAPP_NAME = 'Gmail' 596 _WEBAPP_NAME = 'Gmail'
597 _TAB_TITLE_SUBSTRING = 'Gmail' 597 _TAB_TITLE_SUBSTRING = 'Gmail'
598 _FRAME_XPATH = 'id("canvas_frame")' 598 _FRAME_XPATH = 'id("canvas_frame")'
599 599
600 def setUp(self): 600 def setUp(self):
601 ChromeEndureBaseTest.setUp(self) 601 ChromeEndureBaseTest.setUp(self)
602 602
603 # Log into a test Google account and open up Gmail. 603 # Log into a test Google account and open up Gmail.
604 self._LoginToGoogleAccount(account_key='test_google_account_gmail') 604 self._LoginToGoogleAccount(account_key='test_google_account_gmail')
605 self.NavigateToURL('http://www.gmail.com') 605 self.NavigateToURL(self._GetConfig().get('gmail_url'))
606 loaded_tab_title = self.GetActiveTabTitle() 606 loaded_tab_title = self.GetActiveTabTitle()
607 self.assertTrue(self._TAB_TITLE_SUBSTRING in loaded_tab_title, 607 self.assertTrue(self._TAB_TITLE_SUBSTRING in loaded_tab_title,
608 msg='Loaded tab title does not contain "%s": "%s"' % 608 msg='Loaded tab title does not contain "%s": "%s"' %
609 (self._TAB_TITLE_SUBSTRING, loaded_tab_title)) 609 (self._TAB_TITLE_SUBSTRING, loaded_tab_title))
fdeng1 2012/08/16 17:42:49 I found that if gmail_url is set to 'https://mail.
dennis_jeffrey 2012/08/16 18:49:58 The problem is that line 606 above executes as soo
fdeng1 2012/08/17 06:39:34 Thanks! Use the same workaround.
610 610
611 self._driver = self.NewWebDriver() 611 self._driver = self.NewWebDriver()
612 # Any call to wait.until() will raise an exception if the timeout is hit. 612 # Any call to wait.until() will raise an exception if the timeout is hit.
613 # TODO(dennisjeffrey): Remove the need for webdriver's wait using the new 613 # TODO(dennisjeffrey): Remove the need for webdriver's wait using the new
614 # DOM mutation observer mechanism. 614 # DOM mutation observer mechanism.
615 self._wait = WebDriverWait(self._driver, timeout=60) 615 self._wait = WebDriverWait(self._driver, timeout=60)
616 616
617 # Wait until Gmail's 'canvas_frame' loads and the 'Inbox' link is present. 617 # Wait until Gmail's 'canvas_frame' loads and the 'Inbox' link is present.
618 # TODO(dennisjeffrey): Check with the Gmail team to see if there's a better 618 # TODO(dennisjeffrey): Check with the Gmail team to see if there's a better
619 # way to tell when the webpage is ready for user interaction. 619 # way to tell when the webpage is ready for user interaction.
(...skipping 18 matching lines...) Expand all
638 return True 638 return True
639 except selenium.common.exceptions.NoSuchFrameException: 639 except selenium.common.exceptions.NoSuchFrameException:
640 return False 640 return False
641 641
642 def _GetLatencyDomElement(self): 642 def _GetLatencyDomElement(self):
643 """Returns a reference to the latency info element in the Gmail DOM.""" 643 """Returns a reference to the latency info element in the Gmail DOM."""
644 latency_xpath = ( 644 latency_xpath = (
645 '//span[starts-with(text(), "Why was the last action slow?")]') 645 '//span[starts-with(text(), "Why was the last action slow?")]')
646 self.WaitForDomNode(latency_xpath, frame_xpath=self._FRAME_XPATH) 646 self.WaitForDomNode(latency_xpath, frame_xpath=self._FRAME_XPATH)
647 return self._GetElement(self._driver.find_element_by_xpath, latency_xpath) 647 return self._GetElement(self._driver.find_element_by_xpath, latency_xpath)
648 648
fdeng1 2012/08/16 17:42:49 If we rely on checking the exception that is throw
dennis_jeffrey 2012/08/16 18:49:58 We might be able to avoid this problem in the firs
fdeng1 2012/08/17 06:39:34 I think we can do this. I implemented this and set
dennis_jeffrey 2012/08/17 17:35:44 If you think it'll be safer with 5 seconds, we can
649 def _WaitUntilDomElementRemoved(self, dom_element): 649 def _WaitUntilDomElementRemoved(self, dom_element):
650 """Waits until the given element is no longer attached to the DOM. 650 """Waits until the given element is no longer attached to the DOM.
651 651
652 Args: 652 Args:
653 dom_element: A selenium.webdriver.remote.WebElement object. 653 dom_element: A selenium.webdriver.remote.WebElement object.
654 """ 654 """
655 def _IsElementStale(): 655 def _IsElementStale():
656 try: 656 try:
657 dom_element.tag_name 657 dom_element.tag_name
658 except selenium.common.exceptions.StaleElementReferenceException: 658 except selenium.common.exceptions.StaleElementReferenceException:
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 """Long-running performance tests for Chrome using Google Docs.""" 933 """Long-running performance tests for Chrome using Google Docs."""
934 934
935 _WEBAPP_NAME = 'Docs' 935 _WEBAPP_NAME = 'Docs'
936 _TAB_TITLE_SUBSTRING = 'Google Drive' 936 _TAB_TITLE_SUBSTRING = 'Google Drive'
937 937
938 def setUp(self): 938 def setUp(self):
939 ChromeEndureBaseTest.setUp(self) 939 ChromeEndureBaseTest.setUp(self)
940 940
941 # Log into a test Google account and open up Google Docs. 941 # Log into a test Google account and open up Google Docs.
942 self._LoginToGoogleAccount() 942 self._LoginToGoogleAccount()
943 self.NavigateToURL('http://docs.google.com') 943 self.NavigateToURL(self._GetConfig().get('docs_url'))
944 self.assertTrue( 944 self.assertTrue(
945 self.WaitUntil(lambda: self._TAB_TITLE_SUBSTRING in 945 self.WaitUntil(lambda: self._TAB_TITLE_SUBSTRING in
946 self.GetActiveTabTitle(), 946 self.GetActiveTabTitle(),
947 timeout=60, expect_retval=True, retry_sleep=1), 947 timeout=60, expect_retval=True, retry_sleep=1),
948 msg='Timed out waiting for Docs to load. Tab title is: %s' % 948 msg='Timed out waiting for Docs to load. Tab title is: %s' %
949 self.GetActiveTabTitle()) 949 self.GetActiveTabTitle())
950 950
951 self._driver = self.NewWebDriver() 951 self._driver = self.NewWebDriver()
952 952
953 def testDocsAlternatelyClickLists(self): 953 def testDocsAlternatelyClickLists(self):
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 """Long-running performance tests for Chrome using Google Plus.""" 1005 """Long-running performance tests for Chrome using Google Plus."""
1006 1006
1007 _WEBAPP_NAME = 'Plus' 1007 _WEBAPP_NAME = 'Plus'
1008 _TAB_TITLE_SUBSTRING = 'Google+' 1008 _TAB_TITLE_SUBSTRING = 'Google+'
1009 1009
1010 def setUp(self): 1010 def setUp(self):
1011 ChromeEndureBaseTest.setUp(self) 1011 ChromeEndureBaseTest.setUp(self)
1012 1012
1013 # Log into a test Google account and open up Google Plus. 1013 # Log into a test Google account and open up Google Plus.
1014 self._LoginToGoogleAccount() 1014 self._LoginToGoogleAccount()
1015 self.NavigateToURL('http://plus.google.com') 1015 self.NavigateToURL(self._GetConfig().get('plus_url'))
1016 loaded_tab_title = self.GetActiveTabTitle() 1016 loaded_tab_title = self.GetActiveTabTitle()
1017 self.assertTrue(self._TAB_TITLE_SUBSTRING in loaded_tab_title, 1017 self.assertTrue(self._TAB_TITLE_SUBSTRING in loaded_tab_title,
1018 msg='Loaded tab title does not contain "%s": "%s"' % 1018 msg='Loaded tab title does not contain "%s": "%s"' %
1019 (self._TAB_TITLE_SUBSTRING, loaded_tab_title)) 1019 (self._TAB_TITLE_SUBSTRING, loaded_tab_title))
1020 1020
1021 self._driver = self.NewWebDriver() 1021 self._driver = self.NewWebDriver()
1022 1022
1023 def testPlusAlternatelyClickStreams(self): 1023 def testPlusAlternatelyClickStreams(self):
1024 """Alternates between two different streams. 1024 """Alternates between two different streams.
1025 1025
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 self._num_errors += 1 1118 self._num_errors += 1
1119 1119
1120 time.sleep(1) 1120 time.sleep(1)
1121 1121
1122 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING, 1122 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING,
1123 test_description, scenario) 1123 test_description, scenario)
1124 1124
1125 1125
1126 if __name__ == '__main__': 1126 if __name__ == '__main__':
1127 pyauto_functional.Main() 1127 pyauto_functional.Main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698