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 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 vulnerabilities and should be reverted.""" | 267 vulnerabilities and should be reverted.""" |
268 tabs = self._GetPlatformSpecialURLTabs() | 268 tabs = self._GetPlatformSpecialURLTabs() |
269 for url, properties in tabs.iteritems(): | 269 for url, properties in tabs.iteritems(): |
270 logging.debug('Testing URL %s.' % url) | 270 logging.debug('Testing URL %s.' % url) |
271 self.NavigateToURL(url) | 271 self.NavigateToURL(url) |
272 expected_title = 'title' in properties and properties['title'] or url | 272 expected_title = 'title' in properties and properties['title'] or url |
273 actual_title = self.GetActiveTabTitle() | 273 actual_title = self.GetActiveTabTitle() |
274 self.assertTrue(self.WaitUntil( | 274 self.assertTrue(self.WaitUntil( |
275 lambda: self.GetActiveTabTitle(), expect_retval=expected_title), | 275 lambda: self.GetActiveTabTitle(), expect_retval=expected_title), |
276 msg='Title did not match for %s. Expected: %s. Got %s' % ( | 276 msg='Title did not match for %s. Expected: %s. Got %s' % ( |
277 url, expect_retval, self.GetActiveTabTitle())) | 277 url, expected_title, self.GetActiveTabTitle())) |
278 include_list = [] | 278 include_list = [] |
279 exclude_list = [] | 279 exclude_list = [] |
280 no_csp = 'CSP' in properties and not properties['CSP'] | 280 no_csp = 'CSP' in properties and not properties['CSP'] |
281 if no_csp: | 281 if no_csp: |
282 exclude_list.extend(['X-WebKit-CSP']) | 282 exclude_list.extend(['X-WebKit-CSP']) |
283 else: | 283 else: |
284 exclude_list.extend(['<script>', 'onclick=', 'onload=', | 284 exclude_list.extend(['<script>', 'onclick=', 'onload=', |
285 'onchange=', 'onsubmit=', 'javascript:']) | 285 'onchange=', 'onsubmit=', 'javascript:']) |
286 if 'includes' in properties: | 286 if 'includes' in properties: |
287 include_list.extend(properties['includes']) | 287 include_list.extend(properties['includes']) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 """Test special tabs created by accelerators.""" | 324 """Test special tabs created by accelerators.""" |
325 for accel, title in self.GetSpecialAcceleratorTabs().iteritems(): | 325 for accel, title in self.GetSpecialAcceleratorTabs().iteritems(): |
326 self.RunCommand(accel) | 326 self.RunCommand(accel) |
327 self.assertTrue(self.WaitUntil( | 327 self.assertTrue(self.WaitUntil( |
328 self.GetActiveTabTitle, expect_retval=title), | 328 self.GetActiveTabTitle, expect_retval=title), |
329 msg='Expected "%s", got "%s"' % (title, self.GetActiveTabTitle())) | 329 msg='Expected "%s", got "%s"' % (title, self.GetActiveTabTitle())) |
330 | 330 |
331 | 331 |
332 if __name__ == '__main__': | 332 if __name__ == '__main__': |
333 pyauto_functional.Main() | 333 pyauto_functional.Main() |
OLD | NEW |