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 import os | 6 import os |
7 import re | 7 import re |
8 | 8 |
9 import pyauto_functional | 9 import pyauto_functional |
10 import pyauto | 10 import pyauto |
(...skipping 17 matching lines...) Expand all Loading... |
28 self.assertEqual(2, self.GetTabCount(), msg='Can not open a new tab.') | 28 self.assertEqual(2, self.GetTabCount(), msg='Can not open a new tab.') |
29 self.RunCommand(pyauto.IDC_CLOSE_TAB) | 29 self.RunCommand(pyauto.IDC_CLOSE_TAB) |
30 self.assertEqual(1, self.GetTabCount(), msg='Can not close a tab.') | 30 self.assertEqual(1, self.GetTabCount(), msg='Can not close a tab.') |
31 | 31 |
32 def testReopenClosedTabShortcut(self): | 32 def testReopenClosedTabShortcut(self): |
33 """Verify reopen closed tab shortcut opens recently closed tab.""" | 33 """Verify reopen closed tab shortcut opens recently closed tab.""" |
34 self.RunCommand(pyauto.IDC_NEW_TAB) | 34 self.RunCommand(pyauto.IDC_NEW_TAB) |
35 url = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title2.html')) | 35 url = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title2.html')) |
36 self.NavigateToURL(url) | 36 self.NavigateToURL(url) |
37 title = self.GetActiveTabTitle() | 37 title = self.GetActiveTabTitle() |
38 self.GetBrowserWindow(0).GetTab(1).Close() | 38 self.CloseTab(1, 0) |
39 self.assertEqual(1, self.GetTabCount(), msg='Can not close a tab.') | 39 self.assertEqual(1, self.GetTabCount(), msg='Can not close a tab.') |
40 # Verify shortcut reopens the correct tab. | 40 # Verify shortcut reopens the correct tab. |
41 self.RunCommand(pyauto.IDC_RESTORE_TAB) | 41 self.RunCommand(pyauto.IDC_RESTORE_TAB) |
42 self.assertEqual(2, self.GetTabCount(), msg='Can not restore a tab.') | 42 self.assertEqual(2, self.GetTabCount(), msg='Can not restore a tab.') |
43 self.assertEqual(title, self.GetActiveTabTitle()) | 43 self.assertEqual(title, self.GetActiveTabTitle()) |
44 | 44 |
45 def testNewWindowShortcut(self): | 45 def testNewWindowShortcut(self): |
46 """Verify new window shortcut.""" | 46 """Verify new window shortcut.""" |
47 self.RunCommand(pyauto.IDC_NEW_WINDOW) | 47 self.RunCommand(pyauto.IDC_NEW_WINDOW) |
48 self.assertEquals(2, self.GetBrowserWindowCount()) | 48 self.assertEquals(2, self.GetBrowserWindowCount()) |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 self.assertEquals('Title Of Awesomeness', self.GetActiveTabTitle()) | 202 self.assertEquals('Title Of Awesomeness', self.GetActiveTabTitle()) |
203 # Verify forward navigation. | 203 # Verify forward navigation. |
204 self.RunCommand(pyauto.IDC_FORWARD) | 204 self.RunCommand(pyauto.IDC_FORWARD) |
205 self.assertEquals('Title Of More Awesomeness', self.GetActiveTabTitle()) | 205 self.assertEquals('Title Of More Awesomeness', self.GetActiveTabTitle()) |
206 | 206 |
207 # TODO: Open homepage shortcut. crbug.com/74103 | 207 # TODO: Open homepage shortcut. crbug.com/74103 |
208 | 208 |
209 | 209 |
210 if __name__ == '__main__': | 210 if __name__ == '__main__': |
211 pyauto_functional.Main() | 211 pyauto_functional.Main() |
OLD | NEW |