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 """Basic pyauto performance tests. | 6 """Basic pyauto performance tests. |
7 | 7 |
8 For tests that need to be run for multiple iterations (e.g., so that average | 8 For tests that need to be run for multiple iterations (e.g., so that average |
9 and standard deviation values can be reported), the default number of iterations | 9 and standard deviation values can be reported), the default number of iterations |
10 run for each of these tests is specified by |_DEFAULT_NUM_ITERATIONS|. | 10 run for each of these tests is specified by |_DEFAULT_NUM_ITERATIONS|. |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 self._LoginToGoogleAccount() | 987 self._LoginToGoogleAccount() |
988 self._RunNewTabTest('NewTabCalendar', _RunSingleCalendarTabOpen, | 988 self._RunNewTabTest('NewTabCalendar', _RunSingleCalendarTabOpen, |
989 'open_tab_live_webapp') | 989 'open_tab_live_webapp') |
990 | 990 |
991 def testNewTabDocs(self): | 991 def testNewTabDocs(self): |
992 """Measures time to open a tab to a logged-in Docs account. | 992 """Measures time to open a tab to a logged-in Docs account. |
993 | 993 |
994 Timing starts right before the new tab is opened, and stops as soon as the | 994 Timing starts right before the new tab is opened, and stops as soon as the |
995 webpage displays the expected substring 'last modified' (case insensitive). | 995 webpage displays the expected substring 'last modified' (case insensitive). |
996 """ | 996 """ |
997 EXPECTED_SUBSTRING = 'last modified' | 997 EXPECTED_SUBSTRING = 'sort' |
998 | 998 |
999 def _SubstringExistsOnPage(): | 999 def _SubstringExistsOnPage(): |
1000 js = """ | 1000 js = """ |
1001 var divs = document.getElementsByTagName("div"); | 1001 var divs = document.getElementsByTagName("div"); |
1002 for (var i = 0; i < divs.length; ++i) { | 1002 for (var i = 0; i < divs.length; ++i) { |
1003 if (divs[i].innerHTML.toLowerCase().indexOf("%s") >= 0) | 1003 if (divs[i].innerHTML.toLowerCase().indexOf("%s") >= 0) |
1004 window.domAutomationController.send("true"); | 1004 window.domAutomationController.send("true"); |
1005 } | 1005 } |
1006 window.domAutomationController.send("false"); | 1006 window.domAutomationController.send("false"); |
1007 """ % EXPECTED_SUBSTRING | 1007 """ % EXPECTED_SUBSTRING |
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2612 """Identifies the port number to which the server is currently bound. | 2612 """Identifies the port number to which the server is currently bound. |
2613 | 2613 |
2614 Returns: | 2614 Returns: |
2615 The numeric port number to which the server is currently bound. | 2615 The numeric port number to which the server is currently bound. |
2616 """ | 2616 """ |
2617 return self._server.server_address[1] | 2617 return self._server.server_address[1] |
2618 | 2618 |
2619 | 2619 |
2620 if __name__ == '__main__': | 2620 if __name__ == '__main__': |
2621 pyauto_functional.Main() | 2621 pyauto_functional.Main() |
OLD | NEW |