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

Unified Diff: chrome/test/functional/special_tabs.py

Issue 8124010: Replace <meta> tag with header for content-security-policy on chrome:// pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/functional/special_tabs.py
===================================================================
--- chrome/test/functional/special_tabs.py (revision 103729)
+++ chrome/test/functional/special_tabs.py (working copy)
@@ -43,7 +43,7 @@
'chrome://credits': { 'title': 'Credits', 'CSP': False },
'chrome://downloads': { 'title': 'Downloads' },
'chrome://dns': { 'title': 'About DNS' },
- 'chrome://settings/extensionSettings': { 'title': 'Extensions' },
+ 'chrome://settings/extensions': { 'title': 'Extensions' },
'chrome://flags': {},
'chrome://flash': {},
'chrome://gpu-internals': {},
@@ -58,11 +58,11 @@
'chrome://plugins': { 'title': 'Plug-ins' },
'chrome://sessions': { 'title': 'Sessions' },
'chrome://settings': { 'title': 'Preferences - Basics' },
- 'chrome://stats': { 'CSP': False },
+ 'chrome://stats': {},
'chrome://sync': { 'title': 'Sync Internals' },
'chrome://sync-internals': { 'title': 'Sync Internals' },
'chrome://tasks': { 'title': 'Task Manager - Chromium' },
- 'chrome://terms': { 'CSP': False },
+ 'chrome://terms': {},
'chrome://textfields': { 'title': 'chrome://textfields', 'CSP': False },
'chrome://version': { 'title': 'About Version' },
'chrome://view-http-cache': {},
@@ -281,10 +281,10 @@
self.assertEqual(expected_title, actual_title)
include_list = []
exclude_list = []
- if 'CSP' in properties and not properties['CSP']:
+ no_csp = 'CSP' in properties and not properties['CSP']
+ if no_csp:
exclude_list.extend(['X-WebKit-CSP'])
else:
- include_list.extend(['X-WebKit-CSP'])
exclude_list.extend(['<script>', 'onclick=', 'onload=',
'onchange=', 'onsubmit=', 'javascript:'])
if 'includes' in properties:
@@ -293,6 +293,19 @@
exclude_list.extend(properties['exlcudes'])
test_utils.StringContentCheck(self, self.GetTabContents(),
include_list, exclude_list)
+ result = self.ExecuteJavascript("""
+ var r = 'blocked';
+ var f = 'executed';
+ var s = document.createElement('script');
+ s.textContent = 'r = f';
+ document.body.appendChild(s);
+ window.domAutomationController.send(r);
+ """)
+ logging.debug('has csp %s, result %s.' % (not no_csp, result))
+ if no_csp:
+ self.assertEqual(result, 'executed');
+ else:
+ self.assertEqual(result, 'blocked');
def testAboutAppCacheTab(self):
"""Test App Cache tab to confirm about page populates caches."""

Powered by Google App Engine
This is Rietveld 408576698