OLD | NEW |
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 Loading... |
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, ¶ms)); | 132 kExtensionFromWebStore, ¶ms)); |
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 ¶ms)); | 142 ¶ms)); |
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 ¶ms)); | 147 ¶ms)); |
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 ¶ms)); | 152 ¶ms)); |
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 ¶ms)); | 157 ¶ms)); |
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 ¶ms)); | 162 ¶ms)); |
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 Loading... |
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 ¶ms)); | 187 ¶ms)); |
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 ¶ms)); | 196 ¶ms)); |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
200 } // namespace chrome | 200 } // namespace chrome |
201 | 201 |
OLD | NEW |