OLD | NEW |
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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 logging.warning('Could not identify latency value.') | 696 logging.warning('Could not identify latency value.') |
697 | 697 |
698 def testGmailComposeDiscard(self): | 698 def testGmailComposeDiscard(self): |
699 """Continuously composes/discards an e-mail before sending. | 699 """Continuously composes/discards an e-mail before sending. |
700 | 700 |
701 This test continually composes/discards an e-mail using Gmail, and | 701 This test continually composes/discards an e-mail using Gmail, and |
702 periodically gathers performance stats that may reveal memory bloat. | 702 periodically gathers performance stats that may reveal memory bloat. |
703 """ | 703 """ |
704 test_description = 'ComposeDiscard' | 704 test_description = 'ComposeDiscard' |
705 | 705 |
706 # TODO(dennisjeffrey): Remove following line once crosbug.com/32357 is | |
707 # fixed. | |
708 self._test_length_sec = 60 * 60 * 5 # Run test for 5 hours. | |
709 | |
710 def scenario(): | 706 def scenario(): |
711 # Click the "Compose" button, enter some text into the "To" field, enter | 707 # Click the "Compose" button, enter some text into the "To" field, enter |
712 # some text into the "Subject" field, then click the "Discard" button to | 708 # some text into the "Subject" field, then click the "Discard" button to |
713 # discard the message. | 709 # discard the message. |
714 compose_xpath = '//div[text()="COMPOSE"]' | 710 compose_xpath = '//div[text()="COMPOSE"]' |
715 self.WaitForDomNode(compose_xpath, frame_xpath=self._FRAME_XPATH) | 711 self.WaitForDomNode(compose_xpath, frame_xpath=self._FRAME_XPATH) |
716 compose_button = self._GetElement(self._driver.find_element_by_xpath, | 712 compose_button = self._GetElement(self._driver.find_element_by_xpath, |
717 compose_xpath) | 713 compose_xpath) |
718 self._ClickElementAndRecordLatency( | 714 self._ClickElementAndRecordLatency( |
719 compose_button, test_description, 'Compose') | 715 compose_button, test_description, 'Compose') |
(...skipping 27 matching lines...) Expand all Loading... |
747 # TODO(dennisjeffrey): Remove this test once the Gmail team is done analyzing | 743 # TODO(dennisjeffrey): Remove this test once the Gmail team is done analyzing |
748 # the results after the test runs for a period of time. | 744 # the results after the test runs for a period of time. |
749 def testGmailComposeDiscardSleep(self): | 745 def testGmailComposeDiscardSleep(self): |
750 """Like testGmailComposeDiscard, but sleeps for 30s between iterations. | 746 """Like testGmailComposeDiscard, but sleeps for 30s between iterations. |
751 | 747 |
752 This is a temporary test requested by the Gmail team to compare against the | 748 This is a temporary test requested by the Gmail team to compare against the |
753 results from testGmailComposeDiscard above. | 749 results from testGmailComposeDiscard above. |
754 """ | 750 """ |
755 test_description = 'ComposeDiscardSleep' | 751 test_description = 'ComposeDiscardSleep' |
756 | 752 |
757 # TODO(dennisjeffrey): Remove following line once crosbug.com/32357 is | |
758 # fixed. | |
759 self._test_length_sec = 60 * 60 * 5 # Run test for 5 hours. | |
760 | |
761 def scenario(): | 753 def scenario(): |
762 # Click the "Compose" button, enter some text into the "To" field, enter | 754 # Click the "Compose" button, enter some text into the "To" field, enter |
763 # some text into the "Subject" field, then click the "Discard" button to | 755 # some text into the "Subject" field, then click the "Discard" button to |
764 # discard the message. Finally, sleep for 30 seconds. | 756 # discard the message. Finally, sleep for 30 seconds. |
765 compose_xpath = '//div[text()="COMPOSE"]' | 757 compose_xpath = '//div[text()="COMPOSE"]' |
766 self.WaitForDomNode(compose_xpath, frame_xpath=self._FRAME_XPATH) | 758 self.WaitForDomNode(compose_xpath, frame_xpath=self._FRAME_XPATH) |
767 compose_button = self._GetElement(self._driver.find_element_by_xpath, | 759 compose_button = self._GetElement(self._driver.find_element_by_xpath, |
768 compose_xpath) | 760 compose_xpath) |
769 self._ClickElementAndRecordLatency( | 761 self._ClickElementAndRecordLatency( |
770 compose_button, test_description, 'Compose') | 762 compose_button, test_description, 'Compose') |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 | 1022 |
1031 def testPlusAlternatelyClickStreams(self): | 1023 def testPlusAlternatelyClickStreams(self): |
1032 """Alternates between two different streams. | 1024 """Alternates between two different streams. |
1033 | 1025 |
1034 This test alternately clicks the "Friends" and "Family" buttons using | 1026 This test alternately clicks the "Friends" and "Family" buttons using |
1035 Google Plus, and periodically gathers performance stats that may reveal | 1027 Google Plus, and periodically gathers performance stats that may reveal |
1036 memory bloat. | 1028 memory bloat. |
1037 """ | 1029 """ |
1038 test_description = 'AlternateStreams' | 1030 test_description = 'AlternateStreams' |
1039 | 1031 |
1040 # TODO(dennisjeffrey): Remove following line once crosbug.com/32357 is | |
1041 # fixed. | |
1042 self._test_length_sec = 60 * 60 * 3 # Run test for 3 hours. | |
1043 | |
1044 def scenario(): | 1032 def scenario(): |
1045 # Click the "Friends" button, wait for 1 second, click the "Family" | 1033 # Click the "Friends" button, wait for 1 second, click the "Family" |
1046 # button, wait for 1 second. | 1034 # button, wait for 1 second. |
1047 | 1035 |
1048 # Click the "Friends" button and wait for a resulting div to appear. | 1036 # Click the "Friends" button and wait for a resulting div to appear. |
1049 if not self._ClickElementByXpath( | 1037 if not self._ClickElementByXpath( |
1050 self._driver, | 1038 self._driver, |
1051 '//div[text()="Friends" and ' | 1039 '//div[text()="Friends" and ' |
1052 'starts-with(@data-dest, "stream/circles")]'): | 1040 'starts-with(@data-dest, "stream/circles")]'): |
1053 self._num_errors += 1 | 1041 self._num_errors += 1 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 self._num_errors += 1 | 1118 self._num_errors += 1 |
1131 | 1119 |
1132 time.sleep(1) | 1120 time.sleep(1) |
1133 | 1121 |
1134 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING, | 1122 self._RunEndureTest(self._WEBAPP_NAME, self._TAB_TITLE_SUBSTRING, |
1135 test_description, scenario) | 1123 test_description, scenario) |
1136 | 1124 |
1137 | 1125 |
1138 if __name__ == '__main__': | 1126 if __name__ == '__main__': |
1139 pyauto_functional.Main() | 1127 pyauto_functional.Main() |
OLD | NEW |