diff options
author | sunandt@chromium.org <sunandt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-03 20:37:33 +0000 |
---|---|---|
committer | sunandt@chromium.org <sunandt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-03 20:37:33 +0000 |
commit | 641509a1cc961934f53d373e5fdd14ac79389cfa (patch) | |
tree | d18653731b0ffc9158218eccbaf08f75ad672149 /chrome | |
parent | 56e3379a6a75ead6cbc2999280d9de6b5fb92d47 (diff) | |
download | chromium_src-641509a1cc961934f53d373e5fdd14ac79389cfa.zip chromium_src-641509a1cc961934f53d373e5fdd14ac79389cfa.tar.gz chromium_src-641509a1cc961934f53d373e5fdd14ac79389cfa.tar.bz2 |
Adding a couple of pyauto tests for browser shortcuts.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6594027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76799 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/test/functional/shortcuts.py | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/chrome/test/functional/shortcuts.py b/chrome/test/functional/shortcuts.py index 14a1b52..ad4de20 100644 --- a/chrome/test/functional/shortcuts.py +++ b/chrome/test/functional/shortcuts.py @@ -4,6 +4,7 @@ # found in the LICENSE file. import os +import re import pyauto_functional import pyauto @@ -83,6 +84,20 @@ class ShortcutsTest(pyauto.PyUITest): # TODO: Task Manager Shortcut. crbug.com/73454 + def testClearBrowsingDataShortcut(self): + """Verify clear browsing data shortcut.""" + self.ApplyAccelerator(pyauto.IDC_CLEAR_BROWSING_DATA) + self.assertEquals(2, self.GetTabCount()) + self.assertTrue(re.search('clearBrowserDataOverlay', + self.GetActiveTabURL().spec()), 'Clear browsing data url is wrong.') + # Wait until the clear browsing data DOM UI window opens. + self.assertTrue(self.WaitUntil(lambda: + self.ExecuteJavascript( + 'var element = document.getElementById("clearBrowserDataOverlay");' + 'if(element) window.domAutomationController.send(element.nodeName);' + 'else window.domAutomationController.send(0)', 0, 1), + expect_retval='DIV'), msg='Could not find the DOM UI window element.') + def testViewSourceShortcut(self): """Verify view source shortcut.""" self.ApplyAccelerator(pyauto.IDC_VIEW_SOURCE) @@ -133,8 +148,8 @@ class ShortcutsTest(pyauto.PyUITest): expect_retval=help_page_title), msg='Google Chrome help page has not opened.') - def testSwitchingTabs(self): - """Verify switching tabs shortcut.""" + def testSwitchingTabsShortcuts(self): + """Verify switching tabs shortcuts.""" url1 = self.GetFileURLForDataPath('title1.html') url2 = self.GetFileURLForDataPath('title2.html') url3 = self.GetFileURLForDataPath('title3.html') @@ -161,6 +176,21 @@ class ShortcutsTest(pyauto.PyUITest): self.RunCommand(pyauto.IDC_SELECT_NEXT_TAB) self.assertEquals(titles[x], self.GetActiveTabTitle()) + def testNavigationShortcuts(self): + """Verify back and forward navigation shortcuts from browsing history.""" + url1 = self.GetFileURLForDataPath('title2.html') + url2 = self.GetFileURLForDataPath('title3.html') + for url in [url1, url2]: + self.NavigateToURL(url) + # Verify backward navigation. + self.RunCommand(pyauto.IDC_BACK) + self.assertEquals('Title Of Awesomeness', self.GetActiveTabTitle()) + # Verify forward navigation. + self.RunCommand(pyauto.IDC_FORWARD) + self.assertEquals('Title Of More Awesomeness', self.GetActiveTabTitle()) + + # TODO: Open homepage shortcut. crbug.com/74103 + if __name__ == '__main__': pyauto_functional.Main() |