Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: chrome/test/functional/special_tabs.py

Issue 7455005: Apply content-security-policy to chrome://net-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 'chrome://downloads': { 'title': 'Downloads' }, 51 'chrome://downloads': { 'title': 'Downloads' },
52 'chrome://extensions': { 'title': 'Extensions' }, 52 'chrome://extensions': { 'title': 'Extensions' },
53 'chrome://flags': {}, 53 'chrome://flags': {},
54 'chrome://flash': {}, 54 'chrome://flash': {},
55 'chrome://gpu-internals': { 'CSP': False }, 55 'chrome://gpu-internals': { 'CSP': False },
56 'chrome://histograms': { 'title': 'About Histograms' }, 56 'chrome://histograms': { 'title': 'About Histograms' },
57 'chrome://history': { 'title': 'History' }, 57 'chrome://history': { 'title': 'History' },
58 'chrome://history2': { 'title': 'History', 'CSP': False }, 58 'chrome://history2': { 'title': 'History', 'CSP': False },
59 'chrome://media-internals': { 'title': 'Media Internals', 'CSP': False }, 59 'chrome://media-internals': { 'title': 'Media Internals', 'CSP': False },
60 'chrome://memory-redirect': { 'title': 'About Memory' }, 60 'chrome://memory-redirect': { 'title': 'About Memory' },
61 'chrome://net-internals': { 'CSP': False }, 61 'chrome://net-internals': {},
eroman 2011/07/20 01:50:34 Should this have a 'title' property?
Tom Sepez 2011/07/25 16:59:13 Only if there is a title tag on the page itself. O
62 'chrome://net-internals/help.html': {},
62 'chrome://newtab': { 'title': 'New Tab', 'CSP': False }, 63 'chrome://newtab': { 'title': 'New Tab', 'CSP': False },
63 'chrome://plugins': { 'title': 'Plug-ins' }, 64 'chrome://plugins': { 'title': 'Plug-ins' },
64 'chrome://sessions': { 'title': 'Sessions', 'CSP': False }, 65 'chrome://sessions': { 'title': 'Sessions', 'CSP': False },
65 'chrome://settings': { 'title': 'Preferences - Basics' }, 66 'chrome://settings': { 'title': 'Preferences - Basics' },
66 'chrome://stats': { 'CSP': False }, 67 'chrome://stats': { 'CSP': False },
67 'chrome://sync': { 'title': 'Sync Internals', 'CSP': False }, 68 'chrome://sync': { 'title': 'Sync Internals', 'CSP': False },
68 'chrome://sync-internals': { 'title': 'Sync Internals', 'CSP': False }, 69 'chrome://sync-internals': { 'title': 'Sync Internals', 'CSP': False },
69 'chrome://terms': { 'CSP': False }, 70 'chrome://terms': { 'CSP': False },
70 'chrome://textfields': { 'title': 'chrome://textfields', 'CSP': False }, 71 'chrome://textfields': { 'title': 'chrome://textfields', 'CSP': False },
71 'chrome://version': { 'title': 'About Version' }, 72 'chrome://version': { 'title': 'About Version' },
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 logging.debug(' %s title was %s (%s)' % 264 logging.debug(' %s title was %s (%s)' %
264 (url, actual_title, expected_title == actual_title)) 265 (url, actual_title, expected_title == actual_title))
265 self.assertEqual(expected_title, actual_title) 266 self.assertEqual(expected_title, actual_title)
266 include_list = [] 267 include_list = []
267 exclude_list = [] 268 exclude_list = []
268 if 'CSP' in properties and not properties['CSP']: 269 if 'CSP' in properties and not properties['CSP']:
269 exclude_list.extend(['X-WebKit-CSP']) 270 exclude_list.extend(['X-WebKit-CSP'])
270 else: 271 else:
271 include_list.extend(['X-WebKit-CSP']) 272 include_list.extend(['X-WebKit-CSP'])
272 exclude_list.extend(['<script>', 'onclick=', 'onload=', 273 exclude_list.extend(['<script>', 'onclick=', 'onload=',
273 'onchange=', 'onsubmit=']) 274 'onchange=', 'onsubmit=', 'javascript:'])
274 if 'includes' in properties: 275 if 'includes' in properties:
275 include_list.extend(properties['includes']) 276 include_list.extend(properties['includes'])
276 if 'excludes' in properties: 277 if 'excludes' in properties:
277 exclude_list.extend(properties['exlcudes']) 278 exclude_list.extend(properties['exlcudes'])
278 test_utils.StringContentCheck(self, self.GetTabContents(), 279 test_utils.StringContentCheck(self, self.GetTabContents(),
279 include_list, exclude_list) 280 include_list, exclude_list)
280 281
281 def testAboutAppCacheTab(self): 282 def testAboutAppCacheTab(self):
282 """Test App Cache tab to confirm about page populates caches.""" 283 """Test App Cache tab to confirm about page populates caches."""
283 self.NavigateToURL('about:appcache-internals') 284 self.NavigateToURL('about:appcache-internals')
284 self._VerifyAppCacheInternals() 285 self._VerifyAppCacheInternals()
285 self.assertEqual('AppCache Internals', self.GetActiveTabTitle()) 286 self.assertEqual('AppCache Internals', self.GetActiveTabTitle())
286 287
287 def testAboutDNSTab(self): 288 def testAboutDNSTab(self):
288 """Test DNS tab to confirm DNS about page propogates records.""" 289 """Test DNS tab to confirm DNS about page propogates records."""
289 self.NavigateToURL('about:dns') 290 self.NavigateToURL('about:dns')
290 self._VerifyAboutDNS() 291 self._VerifyAboutDNS()
291 self.assertEqual('About DNS', self.GetActiveTabTitle()) 292 self.assertEqual('About DNS', self.GetActiveTabTitle())
292 293
293 def testSpecialAcceratorTabs(self): 294 def testSpecialAcceratorTabs(self):
294 """Test special tabs created by acclerators like IDC_SHOW_HISTORY, 295 """Test special tabs created by acclerators like IDC_SHOW_HISTORY,
295 IDC_SHOW_DOWNLOADS.""" 296 IDC_SHOW_DOWNLOADS."""
296 for accel, title in self.special_accelerator_tabs.iteritems(): 297 for accel, title in self.special_accelerator_tabs.iteritems():
297 self.RunCommand(accel) 298 self.RunCommand(accel)
298 self.assertEqual(title, self.GetActiveTabTitle()) 299 self.assertEqual(title, self.GetActiveTabTitle())
299 300
300 301
301 if __name__ == '__main__': 302 if __name__ == '__main__':
302 pyauto_functional.Main() 303 pyauto_functional.Main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698