OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 | 485 |
486 Timing starts right before the new tab is opened, and stops as soon as the | 486 Timing starts right before the new tab is opened, and stops as soon as the |
487 webpage displays the calendar print button (title 'Print my calendar'). | 487 webpage displays the calendar print button (title 'Print my calendar'). |
488 """ | 488 """ |
489 EXPECTED_SUBSTRING = 'Print my calendar' | 489 EXPECTED_SUBSTRING = 'Print my calendar' |
490 | 490 |
491 def _DivTitleStartsWith(): | 491 def _DivTitleStartsWith(): |
492 js = """ | 492 js = """ |
493 var divs = document.getElementsByTagName("div"); | 493 var divs = document.getElementsByTagName("div"); |
494 for (var i = 0; i < divs.length; ++i) { | 494 for (var i = 0; i < divs.length; ++i) { |
495 if (divs[i].hasOwnProperty("title") && | 495 if (divs[i].hasOwnProperty("dataset") && |
496 divs[i].title.indexOf("%s") == 0) | 496 divs[i].dataset.hasOwnProperty("tooltip") && |
| 497 divs[i].dataset.tooltip.indexOf("%s") == 0) |
497 window.domAutomationController.send("true"); | 498 window.domAutomationController.send("true"); |
498 } | 499 } |
499 window.domAutomationController.send("false"); | 500 window.domAutomationController.send("false"); |
500 """ % EXPECTED_SUBSTRING | 501 """ % EXPECTED_SUBSTRING |
501 return self.ExecuteJavascript(js, tab_index=1) | 502 return self.ExecuteJavascript(js, tab_index=1) |
502 | 503 |
503 def _RunSingleCalendarTabOpen(): | 504 def _RunSingleCalendarTabOpen(): |
504 self._AppendTab('http://calendar.google.com') | 505 self._AppendTab('http://calendar.google.com') |
505 self.assertTrue(self.WaitUntil(_DivTitleStartsWith, timeout=120, | 506 self.assertTrue(self.WaitUntil(_DivTitleStartsWith, timeout=120, |
506 expect_retval='true', retry_sleep=0.10), | 507 expect_retval='true', retry_sleep=0.10), |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 """Identifies the port number to which the server is currently bound. | 1458 """Identifies the port number to which the server is currently bound. |
1458 | 1459 |
1459 Returns: | 1460 Returns: |
1460 The numeric port number to which the server is currently bound. | 1461 The numeric port number to which the server is currently bound. |
1461 """ | 1462 """ |
1462 return self._server.server_address[1] | 1463 return self._server.server_address[1] |
1463 | 1464 |
1464 | 1465 |
1465 if __name__ == '__main__': | 1466 if __name__ == '__main__': |
1466 pyauto_functional.Main() | 1467 pyauto_functional.Main() |
OLD | NEW |