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

Side by Side Diff: chrome/test/functional/perf.py

Issue 8858001: Minor edits to perf.py to account for UI changes in Gmail/Calendar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 481
482 self._LoginToGoogleAccount() 482 self._LoginToGoogleAccount()
483 self._RunNewTabTest('NewTabGmail', _RunSingleGmailTabOpen) 483 self._RunNewTabTest('NewTabGmail', _RunSingleGmailTabOpen)
484 484
485 def testNewTabCalendar(self): 485 def testNewTabCalendar(self):
486 """Measures time to open a tab to a logged-in Calendar account. 486 """Measures time to open a tab to a logged-in Calendar account.
487 487
488 Timing starts right before the new tab is opened, and stops as soon as the 488 Timing starts right before the new tab is opened, and stops as soon as the
489 webpage displays the calendar print button (title 'Print my calendar'). 489 webpage displays the calendar print button (title 'Print my calendar').
490 """ 490 """
491 EXPECTED_SUBSTRING = 'Print my calendar' 491 EXPECTED_SUBSTRING = 'Month'
492 492
493 def _DivTitleStartsWith(): 493 def _DivTitleStartsWith():
494 js = """ 494 js = """
495 var divs = document.getElementsByTagName("div"); 495 var divs = document.getElementsByTagName("div");
496 for (var i = 0; i < divs.length; ++i) { 496 for (var i = 0; i < divs.length; ++i) {
497 if (divs[i].hasOwnProperty("dataset") && 497 if (divs[i].innerHTML == "%s")
498 divs[i].dataset.hasOwnProperty("tooltip") &&
499 divs[i].dataset.tooltip.indexOf("%s") == 0)
500 window.domAutomationController.send("true"); 498 window.domAutomationController.send("true");
501 } 499 }
502 window.domAutomationController.send("false"); 500 window.domAutomationController.send("false");
503 """ % EXPECTED_SUBSTRING 501 """ % EXPECTED_SUBSTRING
504 return self.ExecuteJavascript(js, tab_index=1) 502 return self.ExecuteJavascript(js, tab_index=1)
505 503
506 def _RunSingleCalendarTabOpen(): 504 def _RunSingleCalendarTabOpen():
507 self._AppendTab('http://calendar.google.com') 505 self._AppendTab('http://calendar.google.com')
508 self.assertTrue(self.WaitUntil(_DivTitleStartsWith, timeout=120, 506 self.assertTrue(self.WaitUntil(_DivTitleStartsWith, timeout=120,
509 expect_retval='true', retry_sleep=0.10), 507 expect_retval='true', retry_sleep=0.10),
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 # interactions: click the "Compose" button, enter some text into the "To" 1059 # interactions: click the "Compose" button, enter some text into the "To"
1062 # field, enter some text into the "Subject" field, then click the "Discard" 1060 # field, enter some text into the "Subject" field, then click the "Discard"
1063 # button to discard the message. 1061 # button to discard the message.
1064 num_iterations = 5 1062 num_iterations = 5
1065 for i in xrange(num_iterations): 1063 for i in xrange(num_iterations):
1066 logging.info('Chrome interaction iteration %d of %d.' % ( 1064 logging.info('Chrome interaction iteration %d of %d.' % (
1067 i + 1, num_iterations)) 1065 i + 1, num_iterations))
1068 1066
1069 compose_button = wait.until(lambda _: _GetElement( 1067 compose_button = wait.until(lambda _: _GetElement(
1070 driver.find_element_by_xpath, 1068 driver.find_element_by_xpath,
1071 '//div[text()="Compose mail"]')) 1069 '//div[text()="COMPOSE"]'))
1072 compose_button.click() 1070 compose_button.click()
1073 1071
1074 to_field = wait.until(lambda _: _GetElement( 1072 to_field = wait.until(lambda _: _GetElement(
1075 driver.find_element_by_name, 'to')) 1073 driver.find_element_by_name, 'to'))
1076 to_field.send_keys('nobody@nowhere.com') 1074 to_field.send_keys('nobody@nowhere.com')
1077 1075
1078 subject_field = wait.until(lambda _: _GetElement( 1076 subject_field = wait.until(lambda _: _GetElement(
1079 driver.find_element_by_name, 'subject')) 1077 driver.find_element_by_name, 'subject'))
1080 subject_field.send_keys('This message is about to be discarded') 1078 subject_field.send_keys('This message is about to be discarded')
1081 1079
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 """Identifies the port number to which the server is currently bound. 1468 """Identifies the port number to which the server is currently bound.
1471 1469
1472 Returns: 1470 Returns:
1473 The numeric port number to which the server is currently bound. 1471 The numeric port number to which the server is currently bound.
1474 """ 1472 """
1475 return self._server.server_address[1] 1473 return self._server.server_address[1]
1476 1474
1477 1475
1478 if __name__ == '__main__': 1476 if __name__ == '__main__':
1479 pyauto_functional.Main() 1477 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698