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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client_unittest.cc

Issue 12089059: Don't grant special privs to any http URL, ever. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "googleurl/src/gurl.h" 8 #include "googleurl/src/gurl.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( 129 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed(
130 GURL("chrome-extension://acadkphlmlegjaadjagenfimbpphcgnh"), 130 GURL("chrome-extension://acadkphlmlegjaadjagenfimbpphcgnh"),
131 GURL(), kNaClRestricted, kExtensionRestricted, 131 GURL(), kNaClRestricted, kExtensionRestricted,
132 kExtensionFromWebStore, &params)); 132 kExtensionFromWebStore, &params));
133 EXPECT_TRUE(AllowsDevInterfaces(params)); 133 EXPECT_TRUE(AllowsDevInterfaces(params));
134 } 134 }
135 // Whitelisted URLs are allowed without --enable-nacl, without 'dev' 135 // Whitelisted URLs are allowed without --enable-nacl, without 'dev'
136 // interfaces. 136 // interfaces.
137 { 137 {
138 WebPluginParams params; 138 WebPluginParams params;
139 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( 139 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed(
140 GURL(), GURL("http://plus.google.com/games"), 140 GURL(), GURL("http://plus.google.com/games"),
141 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, 141 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore,
142 &params)); 142 &params));
143 EXPECT_FALSE(AllowsDevInterfaces(params)); 143 EXPECT_FALSE(AllowsDevInterfaces(params));
144 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( 144 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed(
145 GURL(), GURL("https://plus.google.com/games"), 145 GURL(), GURL("https://plus.google.com/games"),
146 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, 146 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore,
147 &params)); 147 &params));
148 EXPECT_FALSE(AllowsDevInterfaces(params)); 148 EXPECT_FALSE(AllowsDevInterfaces(params));
149 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( 149 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed(
150 GURL(), GURL("https://plus.google.com/games/209089085730"), 150 GURL(), GURL("https://plus.google.com/games/209089085730"),
151 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, 151 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore,
152 &params)); 152 &params));
153 EXPECT_FALSE(AllowsDevInterfaces(params)); 153 EXPECT_FALSE(AllowsDevInterfaces(params));
154 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( 154 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed(
155 GURL(), GURL("http://plus.sandbox.google.com/games"), 155 GURL(), GURL("http://plus.sandbox.google.com/games"),
156 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, 156 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore,
157 &params)); 157 &params));
158 EXPECT_FALSE(AllowsDevInterfaces(params)); 158 EXPECT_FALSE(AllowsDevInterfaces(params));
159 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( 159 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed(
160 GURL(), GURL("https://plus.sandbox.google.com/games"), 160 GURL(), GURL("https://plus.sandbox.google.com/games"),
161 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, 161 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore,
162 &params)); 162 &params));
163 EXPECT_FALSE(AllowsDevInterfaces(params)); 163 EXPECT_FALSE(AllowsDevInterfaces(params));
164 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( 164 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed(
(...skipping 19 matching lines...) Expand all
184 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( 184 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed(
185 GURL(), GURL("https://plus.google.com/games/209089085730"), 185 GURL(), GURL("https://plus.google.com/games/209089085730"),
186 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, 186 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore,
187 &params)); 187 &params));
188 EXPECT_FALSE(AllowsDevInterfaces(params)); 188 EXPECT_FALSE(AllowsDevInterfaces(params));
189 } 189 }
190 // Non-whitelisted URLs are blocked without --enable-nacl. 190 // Non-whitelisted URLs are blocked without --enable-nacl.
191 { 191 {
192 WebPluginParams params; 192 WebPluginParams params;
193 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( 193 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed(
194 GURL(), GURL("http://plus.google.com.evil.com/games"), 194 GURL(), GURL("https://plus.google.com.evil.com/games"),
195 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, 195 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore,
196 &params)); 196 &params));
197 } 197 }
198 } 198 }
199 199
200 } // namespace chrome 200 } // namespace chrome
201 201
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698