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 |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 special_url_tabs = { | 35 special_url_tabs = { |
36 'chrome://about': { 'title': 'Chrome URLs' }, | 36 'chrome://about': { 'title': 'Chrome URLs' }, |
37 'chrome://appcache-internals': { 'title': 'AppCache Internals' }, | 37 'chrome://appcache-internals': { 'title': 'AppCache Internals' }, |
38 'chrome://blob-internals': { 'title': 'Blob Storage Internals' }, | 38 'chrome://blob-internals': { 'title': 'Blob Storage Internals' }, |
39 'chrome://bugreport': {}, | 39 'chrome://bugreport': {}, |
40 'chrome://bugreport/#0': { 'title': 'Feedback' }, | 40 'chrome://bugreport/#0': { 'title': 'Feedback' }, |
41 'chrome://chrome-urls': { 'title': 'Chrome URLs' }, | 41 'chrome://chrome-urls': { 'title': 'Chrome URLs' }, |
42 'chrome://crashes': { 'title': 'Crashes' }, | 42 'chrome://crashes': { 'title': 'Crashes' }, |
43 'chrome://credits': { 'title': 'Credits', 'CSP': False }, | 43 'chrome://credits': { 'title': 'Credits' }, |
44 'chrome://downloads': { 'title': 'Downloads' }, | 44 'chrome://downloads': { 'title': 'Downloads' }, |
45 'chrome://dns': { 'title': 'About DNS' }, | 45 'chrome://dns': { 'title': 'About DNS' }, |
46 'chrome://settings/extensionSettings': { 'title': 'Extensions' }, | 46 'chrome://settings/extensionSettings': { 'title': 'Extensions' }, |
47 'chrome://flags': {}, | 47 'chrome://flags': {}, |
48 'chrome://flash': {}, | 48 'chrome://flash': {}, |
49 'chrome://gpu-internals': {}, | 49 'chrome://gpu-internals': {}, |
50 'chrome://histograms': { 'title': 'About Histograms' }, | 50 'chrome://histograms': { 'title': 'About Histograms' }, |
51 'chrome://history': { 'title': 'History' }, | 51 'chrome://history': { 'title': 'History' }, |
52 'chrome://history2': { 'title': 'History' }, | 52 'chrome://history2': { 'title': 'History' }, |
53 'chrome://media-internals': { 'title': 'Media Internals' }, | 53 'chrome://media-internals': { 'title': 'Media Internals' }, |
54 'chrome://memory-redirect': { 'title': 'About Memory' }, | 54 'chrome://memory-redirect': { 'title': 'About Memory' }, |
55 'chrome://net-internals': {}, | 55 'chrome://net-internals': {}, |
56 'chrome://net-internals/help.html': {}, | 56 'chrome://net-internals/help.html': {}, |
57 'chrome://newtab': { 'title': 'New Tab', 'CSP': False }, | 57 'chrome://newtab': { 'title': 'New Tab' }, |
58 'chrome://plugins': { 'title': 'Plug-ins' }, | 58 'chrome://plugins': { 'title': 'Plug-ins' }, |
59 'chrome://sessions': { 'title': 'Sessions' }, | 59 'chrome://sessions': { 'title': 'Sessions' }, |
60 'chrome://settings': { 'title': 'Preferences - Basics' }, | 60 'chrome://settings': { 'title': 'Preferences - Basics' }, |
61 'chrome://stats': { 'CSP': False }, | 61 'chrome://stats': {}, |
62 'chrome://sync': { 'title': 'Sync Internals' }, | 62 'chrome://sync': { 'title': 'Sync Internals' }, |
63 'chrome://sync-internals': { 'title': 'Sync Internals' }, | 63 'chrome://sync-internals': { 'title': 'Sync Internals' }, |
64 'chrome://tasks': { 'title': 'Task Manager - Chromium' }, | 64 'chrome://tasks': { 'title': 'Task Manager - Chromium' }, |
65 'chrome://terms': { 'CSP': False }, | 65 'chrome://terms': {}, |
66 'chrome://textfields': { 'title': 'chrome://textfields', 'CSP': False }, | 66 'chrome://textfields': { 'title': 'chrome://textfields' }, |
67 'chrome://version': { 'title': 'About Version' }, | 67 'chrome://version': { 'title': 'About Version' }, |
68 'chrome://view-http-cache': {}, | 68 'chrome://view-http-cache': {}, |
69 'chrome://workers': { 'title': 'Workers' }, | 69 'chrome://workers': { 'title': 'Workers' }, |
70 } | 70 } |
71 broken_special_url_tabs = { | 71 broken_special_url_tabs = { |
72 # crashed under debug when invoked from location bar (bug 88223). | 72 # crashed under debug when invoked from location bar (bug 88223). |
73 'chrome://devtools': { 'CSP': False }, | 73 'chrome://devtools': {}, |
74 | 74 |
75 # returns "not available" despite having an URL constant. | 75 # returns "not available" despite having an URL constant. |
76 'chrome://dialog': { 'CSP': False }, | 76 'chrome://dialog': {}, |
77 | 77 |
78 # separate window on mac, PC untested, not implemented elsewhere. | 78 # separate window on mac, PC untested, not implemented elsewhere. |
79 'chrome://ipc': { 'CSP': False }, | 79 'chrome://ipc': {}, |
80 | 80 |
81 # race against redirects via meta-refresh. | 81 # race against redirects via meta-refresh. |
82 'chrome://memory': { 'CSP': False }, | 82 'chrome://memory': {}, |
83 } | 83 } |
84 | 84 |
85 chromeos_special_url_tabs = { | 85 chromeos_special_url_tabs = { |
86 'chrome://active-downloads': { 'title': 'Downloads', 'CSP': False }, | 86 'chrome://active-downloads': { 'title': 'Downloads' }, |
87 'chrome://choose-mobile-network': { 'title': 'undefined', 'CSP': False }, | 87 'chrome://choose-mobile-network': { 'title': 'undefined' }, |
88 'chrome://imageburner': { 'title':'Create a Recovery Media', 'CSP': False }, | 88 'chrome://imageburner': { 'title':'Create a Recovery Media' }, |
89 'chrome://keyboardoverlay': { 'title': 'Keyboard Overlay', 'CSP': False }, | 89 'chrome://keyboardoverlay': { 'title': 'Keyboard Overlay' }, |
90 'chrome://login': { 'CSP': False }, | 90 'chrome://login': {}, |
91 'chrome://network': { 'title': 'About Network' }, | 91 'chrome://network': { 'title': 'About Network' }, |
92 'chrome://oobe': { 'title': 'undefined', 'CSP': False }, | 92 'chrome://oobe': { 'title': 'undefined' }, |
93 'chrome://os-credits': { 'title': 'Credits', 'CSP': False }, | 93 'chrome://os-credits': { 'title': 'Credits' }, |
94 'chrome://proxy-settings': { 'CSP': False }, | 94 'chrome://proxy-settings': {}, |
95 'chrome://register': { 'CSP': False }, | 95 'chrome://register': {}, |
96 'chrome://sim-unlock': { 'title': 'Enter SIM Card PIN', 'CSP': False }, | 96 'chrome://sim-unlock': { 'title': 'Enter SIM Card PIN' }, |
97 'chrome://system': { 'title': 'About System', 'CSP': False }, | 97 'chrome://system': { 'title': 'About System' }, |
98 | 98 |
99 # OVERRIDE - usually a warning page without CSP (so far). | 99 # OVERRIDE - usually a warning page without CSP (so far). |
100 'chrome://flags': { 'CSP': False }, | 100 'chrome://flags': {}, |
101 | 101 |
102 # OVERRIDE - title and page different on CrOS | 102 # OVERRIDE - title and page different on CrOS |
103 'chrome://settings/about': { 'title': 'Settings - About' }, | 103 'chrome://settings/about': { 'title': 'Settings - About' }, |
104 'chrome://settings/accounts': { 'title': 'Settings - Users' }, | 104 'chrome://settings/accounts': { 'title': 'Settings - Users' }, |
105 'chrome://settings/advanced': { 'title': 'Settings - Under the Hood' }, | 105 'chrome://settings/advanced': { 'title': 'Settings - Under the Hood' }, |
106 'chrome://settings/autofill': { 'title': 'Settings - Autofill Settings' }, | 106 'chrome://settings/autofill': { 'title': 'Settings - Autofill Settings' }, |
107 'chrome://settings/browser': { 'title': 'Settings - Basics' }, | 107 'chrome://settings/browser': { 'title': 'Settings - Basics' }, |
108 'chrome://settings/clearBrowserData': | 108 'chrome://settings/clearBrowserData': |
109 { 'title': 'Settings - Clear Browsing Data' }, | 109 { 'title': 'Settings - Clear Browsing Data' }, |
110 'chrome://settings/content': { 'title': 'Settings - Content Settings' }, | 110 'chrome://settings/content': { 'title': 'Settings - Content Settings' }, |
111 'chrome://settings/internet': { 'title': 'Settings - Internet' }, | 111 'chrome://settings/internet': { 'title': 'Settings - Internet' }, |
112 'chrome://settings/languages': | 112 'chrome://settings/languages': |
113 { 'title': 'Settings - Languages and Input' }, | 113 { 'title': 'Settings - Languages and Input' }, |
114 'chrome://settings/passwords': { 'title': 'Settings - Passwords' }, | 114 'chrome://settings/passwords': { 'title': 'Settings - Passwords' }, |
115 'chrome://settings/personal': { 'title': 'Settings - Personal Stuff' }, | 115 'chrome://settings/personal': { 'title': 'Settings - Personal Stuff' }, |
116 'chrome://settings/proxy': { 'title': 'Proxy' }, | 116 'chrome://settings/proxy': { 'title': 'Proxy' }, |
117 'chrome://settings/system': { 'title': 'Settings - System' }, | 117 'chrome://settings/system': { 'title': 'Settings - System' }, |
118 } | 118 } |
119 broken_chromeos_special_url_tabs = { | 119 broken_chromeos_special_url_tabs = { |
120 # returns "not available" page on chromeos=1 linux but has an URL constant. | 120 # returns "not available" page on chromeos=1 linux but has an URL constant. |
121 'chrome://activationmessage': { 'CSP': False }, | 121 'chrome://activationmessage': {}, |
122 'chrome://cloudprintresources': { 'CSP': False }, | 122 'chrome://cloudprintresources': {}, |
123 'chrome://cloudprintsetup': { 'CSP': False }, | 123 'chrome://cloudprintsetup': {}, |
124 'chrome://collected-cookies': { 'CSP': False }, | 124 'chrome://collected-cookies': {}, |
125 'chrome://constrained-test': { 'CSP': False }, | 125 'chrome://constrained-test': {}, |
126 'chrome://enterprise-enrollment': { 'CSP': False }, | 126 'chrome://enterprise-enrollment': {}, |
127 'chrome://http-auth': { 'CSP': False }, | 127 'chrome://http-auth': {}, |
128 'chrome://login-container': { 'CSP': False }, | 128 'chrome://login-container': {}, |
129 'chrome://media-player': { 'CSP': False }, | 129 'chrome://media-player': {}, |
130 'chrome://screenshots': { 'CSP': False }, | 130 'chrome://screenshots': {}, |
131 'chrome://slideshow': { 'CSP': False }, | 131 'chrome://slideshow': {}, |
132 'chrome://syncresources': { 'CSP': False }, | 132 'chrome://syncresources': {}, |
133 'chrome://theme': { 'CSP': False }, | 133 'chrome://theme': {}, |
134 | 134 |
135 # crashes on chromeos=1 on linux, possibly missing real CrOS features. | 135 # crashes on chromeos=1 on linux, possibly missing real CrOS features. |
136 'chrome://cryptohome': { 'CSP': False}, | 136 'chrome://cryptohome': { }, |
137 'chrome://mobilesetup': { 'CSP': False }, | 137 'chrome://mobilesetup': {}, |
138 'chrome://print': { 'CSP': False }, | 138 'chrome://print': {}, |
139 'chrome://tasks': {}, | 139 'chrome://tasks': {}, |
140 } | 140 } |
141 | 141 |
142 linux_special_url_tabs = { | 142 linux_special_url_tabs = { |
143 'chrome://linux-proxy-config': { 'title': 'Proxy Configuration Help' }, | 143 'chrome://linux-proxy-config': { 'title': 'Proxy Configuration Help' }, |
144 'chrome://tcmalloc': { 'title': 'About tcmalloc' }, | 144 'chrome://tcmalloc': { 'title': 'About tcmalloc' }, |
145 'chrome://sandbox': { 'title': 'Sandbox Status' }, | 145 'chrome://sandbox': { 'title': 'Sandbox Status' }, |
146 } | 146 } |
147 broken_linux_special_url_tabs = {} | 147 broken_linux_special_url_tabs = {} |
148 | 148 |
149 mac_special_url_tabs = {} | 149 mac_special_url_tabs = {} |
150 broken_mac_special_url_tabs = {} | 150 broken_mac_special_url_tabs = {} |
151 | 151 |
152 win_special_url_tabs = { | 152 win_special_url_tabs = { |
153 'chrome://conflicts': {}, | 153 'chrome://conflicts': {}, |
154 | 154 |
155 # OVERRIDE - different title for page. | 155 # OVERRIDE - different title for page. |
156 'chrome://settings': { 'title': 'Options - Basics' }, | 156 'chrome://settings': { 'title': 'Options - Basics' }, |
157 } | 157 } |
158 broken_win_special_url_tabs = { | 158 broken_win_special_url_tabs = { |
159 # Sync on windows badly broken at the moment. | 159 # Sync on windows badly broken at the moment. |
160 'chrome://sync': {}, | 160 'chrome://sync': {}, |
161 } | 161 } |
162 | 162 |
163 google_special_url_tabs = { | 163 google_special_url_tabs = { |
164 # OVERRIDE - different title for Google Chrome vs. Chromium. | 164 # OVERRIDE - different title for Google Chrome vs. Chromium. |
165 'chrome://terms': { | 165 'chrome://terms': { |
166 'title': 'Google Chrome Terms of Service', | 166 'title': 'Google Chrome Terms of Service', |
167 'CSP': False | |
168 }, | 167 }, |
169 } | 168 } |
170 broken_google_special_url_tabs = {} | 169 broken_google_special_url_tabs = {} |
171 | 170 |
172 google_chromeos_special_url_tabs = { | 171 google_chromeos_special_url_tabs = { |
173 # OVERRIDE - different title for Google Chrome OS vs. Chromium OS. | 172 # OVERRIDE - different title for Google Chrome OS vs. Chromium OS. |
174 'chrome://terms': { | 173 'chrome://terms': { |
175 'title': 'Google Chrome OS Terms', | 174 'title': 'Google Chrome OS Terms', |
176 'CSP': False | |
177 }, | 175 }, |
178 } | 176 } |
179 broken_google_chromeos_special_url_tabs = {} | 177 broken_google_chromeos_special_url_tabs = {} |
180 | 178 |
181 google_win_special_url_tabs = {} | 179 google_win_special_url_tabs = {} |
182 broken_google_win_special_url_tabs = {} | 180 broken_google_win_special_url_tabs = {} |
183 | 181 |
184 google_mac_special_url_tabs = {} | 182 google_mac_special_url_tabs = {} |
185 broken_google_mac_special_url_tabs = {} | 183 broken_google_mac_special_url_tabs = {} |
186 | 184 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 logging.debug('Testing URL %s.' % url) | 273 logging.debug('Testing URL %s.' % url) |
276 self.NavigateToURL(url) | 274 self.NavigateToURL(url) |
277 expected_title = 'title' in properties and properties['title'] or url | 275 expected_title = 'title' in properties and properties['title'] or url |
278 actual_title = self.GetActiveTabTitle() | 276 actual_title = self.GetActiveTabTitle() |
279 logging.debug(' %s title was %s (%s)' % | 277 logging.debug(' %s title was %s (%s)' % |
280 (url, actual_title, expected_title == actual_title)) | 278 (url, actual_title, expected_title == actual_title)) |
281 self.assertEqual(expected_title, actual_title) | 279 self.assertEqual(expected_title, actual_title) |
282 include_list = [] | 280 include_list = [] |
283 exclude_list = [] | 281 exclude_list = [] |
284 if 'CSP' in properties and not properties['CSP']: | 282 if 'CSP' in properties and not properties['CSP']: |
285 exclude_list.extend(['X-WebKit-CSP']) | |
286 else: | 283 else: |
287 include_list.extend(['X-WebKit-CSP']) | |
288 exclude_list.extend(['<script>', 'onclick=', 'onload=', | 284 exclude_list.extend(['<script>', 'onclick=', 'onload=', |
289 'onchange=', 'onsubmit=', 'javascript:']) | 285 'onchange=', 'onsubmit=', 'javascript:']) |
290 if 'includes' in properties: | 286 if 'includes' in properties: |
291 include_list.extend(properties['includes']) | 287 include_list.extend(properties['includes']) |
292 if 'excludes' in properties: | 288 if 'excludes' in properties: |
293 exclude_list.extend(properties['exlcudes']) | 289 exclude_list.extend(properties['exlcudes']) |
294 test_utils.StringContentCheck(self, self.GetTabContents(), | 290 test_utils.StringContentCheck(self, self.GetTabContents(), |
295 include_list, exclude_list) | 291 include_list, exclude_list) |
296 | 292 |
297 def testAboutAppCacheTab(self): | 293 def testAboutAppCacheTab(self): |
(...skipping 13 matching lines...) Expand all Loading... |
311 IDC_SHOW_DOWNLOADS.""" | 307 IDC_SHOW_DOWNLOADS.""" |
312 for accel, title in self.special_accelerator_tabs.iteritems(): | 308 for accel, title in self.special_accelerator_tabs.iteritems(): |
313 self.RunCommand(accel) | 309 self.RunCommand(accel) |
314 self.assertTrue(self.WaitUntil( | 310 self.assertTrue(self.WaitUntil( |
315 self.GetActiveTabTitle, expect_retval=title), | 311 self.GetActiveTabTitle, expect_retval=title), |
316 msg='Expected "%s"' % title) | 312 msg='Expected "%s"' % title) |
317 | 313 |
318 | 314 |
319 if __name__ == '__main__': | 315 if __name__ == '__main__': |
320 pyauto_functional.Main() | 316 pyauto_functional.Main() |
OLD | NEW |