| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/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 import logging | 6 import logging |
| 7 import os | 7 import os |
| 8 | 8 |
| 9 import pyauto_functional # Must be imported before pyauto | 9 import pyauto_functional # Must be imported before pyauto |
| 10 import pyauto | 10 import pyauto |
| 11 import test_utils | 11 import test_utils |
| 12 | 12 |
| 13 class SpecialTabsTest(pyauto.PyUITest): | 13 class SpecialTabsTest(pyauto.PyUITest): |
| 14 """TestCase for Special Tabs like about:version, chrome://history, etc.""" | 14 """TestCase for Special Tabs like about:version, chrome://history, etc.""" |
| 15 | 15 |
| 16 special_accelerator_tabs = { | 16 @staticmethod |
| 17 pyauto.IDC_SHOW_HISTORY: 'History', | 17 def GetSpecialAcceleratorTabs(): |
| 18 pyauto.IDC_MANAGE_EXTENSIONS: '%s - Extensions' % ('Options' if | 18 """Get a dict of accelerators and corresponding tab titles.""" |
| 19 pyauto.PyUITest.IsWin() else 'Preferences'), | 19 ret = { |
| 20 pyauto.IDC_SHOW_DOWNLOADS: 'Downloads', | 20 pyauto.IDC_SHOW_HISTORY: 'History', |
| 21 } | 21 pyauto.IDC_MANAGE_EXTENSIONS: 'Preferences - Extensions', |
| 22 pyauto.IDC_SHOW_DOWNLOADS: 'Downloads', |
| 23 } |
| 24 if pyauto.PyUITest.IsWin(): |
| 25 ret[pyauto.IDC_MANAGE_EXTENSIONS] = 'Options - Extensions' |
| 26 elif pyauto.PyUITest.IsChromeOS(): |
| 27 ret[pyauto.IDC_MANAGE_EXTENSIONS] = 'Settings - Extensions' |
| 28 return ret |
| 22 | 29 |
| 23 special_url_redirects = { | 30 special_url_redirects = { |
| 24 'about:': 'chrome://version', | 31 'about:': 'chrome://version', |
| 25 'about:about': 'chrome://about', | 32 'about:about': 'chrome://about', |
| 26 'about:appcache-internals': 'chrome://appcache-internals', | 33 'about:appcache-internals': 'chrome://appcache-internals', |
| 27 'about:credits': 'chrome://credits', | 34 'about:credits': 'chrome://credits', |
| 28 'about:dns': 'chrome://dns', | 35 'about:dns': 'chrome://dns', |
| 29 'about:histograms': 'chrome://histograms', | 36 'about:histograms': 'chrome://histograms', |
| 30 'about:plugins': 'chrome://plugins', | 37 'about:plugins': 'chrome://plugins', |
| 31 'about:sync': 'chrome://sync-internals', | 38 'about:sync': 'chrome://sync-internals', |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 108 |
| 102 # OVERRIDE - title and page different on CrOS | 109 # OVERRIDE - title and page different on CrOS |
| 103 'chrome://settings/about': { 'title': 'Settings - About' }, | 110 'chrome://settings/about': { 'title': 'Settings - About' }, |
| 104 'chrome://settings/accounts': { 'title': 'Settings - Users' }, | 111 'chrome://settings/accounts': { 'title': 'Settings - Users' }, |
| 105 'chrome://settings/advanced': { 'title': 'Settings - Under the Hood' }, | 112 'chrome://settings/advanced': { 'title': 'Settings - Under the Hood' }, |
| 106 'chrome://settings/autofill': { 'title': 'Settings - Autofill Settings' }, | 113 'chrome://settings/autofill': { 'title': 'Settings - Autofill Settings' }, |
| 107 'chrome://settings/browser': { 'title': 'Settings - Basics' }, | 114 'chrome://settings/browser': { 'title': 'Settings - Basics' }, |
| 108 'chrome://settings/clearBrowserData': | 115 'chrome://settings/clearBrowserData': |
| 109 { 'title': 'Settings - Clear Browsing Data' }, | 116 { 'title': 'Settings - Clear Browsing Data' }, |
| 110 'chrome://settings/content': { 'title': 'Settings - Content Settings' }, | 117 'chrome://settings/content': { 'title': 'Settings - Content Settings' }, |
| 118 'chrome://settings/extensions': { 'title': 'Settings - Extensions' }, |
| 111 'chrome://settings/internet': { 'title': 'Settings - Internet' }, | 119 'chrome://settings/internet': { 'title': 'Settings - Internet' }, |
| 112 'chrome://settings/languages': | 120 'chrome://settings/languages': |
| 113 { 'title': 'Settings - Languages and Input' }, | 121 { 'title': 'Settings - Languages and Input' }, |
| 114 'chrome://settings/passwords': { 'title': 'Settings - Passwords' }, | 122 'chrome://settings/passwords': { 'title': 'Settings - Passwords' }, |
| 115 'chrome://settings/personal': { 'title': 'Settings - Personal Stuff' }, | 123 'chrome://settings/personal': { 'title': 'Settings - Personal Stuff' }, |
| 116 'chrome://settings/proxy': { 'title': 'Proxy' }, | 124 'chrome://settings/proxy': { 'title': 'Proxy' }, |
| 117 'chrome://settings/system': { 'title': 'Settings - System' }, | 125 'chrome://settings/system': { 'title': 'Settings - System' }, |
| 118 } | 126 } |
| 119 broken_chromeos_special_url_tabs = { | 127 broken_chromeos_special_url_tabs = { |
| 120 # returns "not available" page on chromeos=1 linux but has an URL constant. | 128 # returns "not available" page on chromeos=1 linux but has an URL constant. |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 324 |
| 317 def testAboutDNSTab(self): | 325 def testAboutDNSTab(self): |
| 318 """Test DNS tab to confirm DNS about page propogates records.""" | 326 """Test DNS tab to confirm DNS about page propogates records.""" |
| 319 self.NavigateToURL('about:dns') | 327 self.NavigateToURL('about:dns') |
| 320 self._VerifyAboutDNS() | 328 self._VerifyAboutDNS() |
| 321 self.assertEqual('About DNS', self.GetActiveTabTitle()) | 329 self.assertEqual('About DNS', self.GetActiveTabTitle()) |
| 322 | 330 |
| 323 def testSpecialAcceratorTabs(self): | 331 def testSpecialAcceratorTabs(self): |
| 324 """Test special tabs created by acclerators like IDC_SHOW_HISTORY, | 332 """Test special tabs created by acclerators like IDC_SHOW_HISTORY, |
| 325 IDC_SHOW_DOWNLOADS.""" | 333 IDC_SHOW_DOWNLOADS.""" |
| 326 for accel, title in self.special_accelerator_tabs.iteritems(): | 334 for accel, title in self.GetSpecialAcceleratorTabs().iteritems(): |
| 327 self.RunCommand(accel) | 335 self.RunCommand(accel) |
| 328 self.assertTrue(self.WaitUntil( | 336 self.assertTrue(self.WaitUntil( |
| 329 self.GetActiveTabTitle, expect_retval=title), | 337 self.GetActiveTabTitle, expect_retval=title), |
| 330 msg='Expected "%s"' % title) | 338 msg='Expected "%s"' % title) |
| 331 | 339 |
| 332 | 340 |
| 333 if __name__ == '__main__': | 341 if __name__ == '__main__': |
| 334 pyauto_functional.Main() | 342 pyauto_functional.Main() |
| OLD | NEW |