| 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 "chrome/common/extensions/extension.h" |
| 9 #include "chrome/common/extensions/extension_builder.h" |
| 10 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 8 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
| 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" |
| 13 #include "webkit/plugins/webplugininfo.h" | 16 #include "webkit/plugins/webplugininfo.h" |
| 14 | 17 |
| 15 using WebKit::WebPluginParams; | 18 using WebKit::WebPluginParams; |
| 16 using WebKit::WebString; | 19 using WebKit::WebString; |
| 17 using WebKit::WebVector; | 20 using WebKit::WebVector; |
| 18 using chrome::ChromeContentRendererClient; | 21 using chrome::ChromeContentRendererClient; |
| 19 using webkit::WebPluginInfo; | 22 using webkit::WebPluginInfo; |
| 20 using webkit::WebPluginMimeType; | 23 using webkit::WebPluginMimeType; |
| 21 | 24 |
| 22 namespace chrome { | 25 namespace chrome { |
| 23 | 26 |
| 24 namespace { | 27 namespace { |
| 25 const bool kNaClRestricted = false; | 28 const bool kNaClRestricted = false; |
| 26 const bool kNaClUnrestricted = true; | 29 const bool kNaClUnrestricted = true; |
| 27 const bool kExtensionRestricted = false; | 30 const bool kExtensionRestricted = false; |
| 28 const bool kExtensionUnrestricted = true; | 31 const bool kExtensionUnrestricted = true; |
| 29 const bool kExtensionNotFromWebStore = false; | 32 const bool kExtensionNotFromWebStore = false; |
| 30 const bool kExtensionFromWebStore = true; | 33 const bool kExtensionFromWebStore = true; |
| 34 const bool kNotHostedApp = false; |
| 35 const bool kHostedApp = true; |
| 31 | 36 |
| 32 const char kNaClMimeType[] = "application/x-nacl"; | 37 const char kNaClMimeType[] = "application/x-nacl"; |
| 33 const char kExtensionUrl[] = "chrome-extension://extension_id/background.html"; | 38 const char kExtensionUrl[] = "chrome-extension://extension_id/background.html"; |
| 34 | 39 |
| 35 bool AllowsDevInterfaces(const WebPluginParams& params) { | 40 bool AllowsDevInterfaces(const WebPluginParams& params) { |
| 36 for (size_t i = 0; i < params.attributeNames.size(); ++i) { | 41 for (size_t i = 0; i < params.attributeNames.size(); ++i) { |
| 37 if (params.attributeNames[i] == WebString::fromUTF8("@dev")) | 42 if (params.attributeNames[i] == WebString::fromUTF8("@dev")) |
| 38 return true; | 43 return true; |
| 39 } | 44 } |
| 40 return false; | 45 return false; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 56 mime_type_info.mime_type = mime_type; | 61 mime_type_info.mime_type = mime_type; |
| 57 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl")); | 62 mime_type_info.additional_param_names.push_back(UTF8ToUTF16("nacl")); |
| 58 mime_type_info.additional_param_values.push_back( | 63 mime_type_info.additional_param_values.push_back( |
| 59 UTF8ToUTF16(manifest_url)); | 64 UTF8ToUTF16(manifest_url)); |
| 60 info->mime_types.push_back(mime_type_info); | 65 info->mime_types.push_back(mime_type_info); |
| 61 } | 66 } |
| 62 } // namespace | 67 } // namespace |
| 63 | 68 |
| 64 typedef testing::Test ChromeContentRendererClientTest; | 69 typedef testing::Test ChromeContentRendererClientTest; |
| 65 | 70 |
| 71 |
| 72 scoped_refptr<const extensions::Extension> CreateTestExtension( |
| 73 bool is_unrestricted, bool is_from_webstore, bool is_hosted_app, |
| 74 const std::string& app_url) { |
| 75 extensions::Manifest::Location location = is_unrestricted ? |
| 76 extensions::Manifest::UNPACKED : |
| 77 extensions::Manifest::INTERNAL; |
| 78 int flags = is_from_webstore ? |
| 79 extensions::Extension::FROM_WEBSTORE: |
| 80 extensions::Extension::NO_FLAGS; |
| 81 |
| 82 DictionaryValue manifest; |
| 83 manifest.SetString("name", "NaCl Extension"); |
| 84 manifest.SetString("version", "1"); |
| 85 manifest.SetInteger("manifest_version", 2); |
| 86 if (is_hosted_app) { |
| 87 ListValue* url_list = new ListValue(); |
| 88 url_list->Append(Value::CreateStringValue(app_url)); |
| 89 manifest.Set(extension_manifest_keys::kWebURLs, url_list); |
| 90 manifest.SetString(extension_manifest_keys::kLaunchWebURL, app_url); |
| 91 } |
| 92 std::string error; |
| 93 return extensions::Extension::Create(base::FilePath(), location, manifest, |
| 94 flags, &error); |
| 95 } |
| 96 |
| 97 scoped_refptr<const extensions::Extension> CreateExtension( |
| 98 bool is_unrestricted, bool is_from_webstore) { |
| 99 return CreateTestExtension(is_unrestricted, is_from_webstore, kNotHostedApp, |
| 100 ""); |
| 101 } |
| 102 |
| 103 scoped_refptr<const extensions::Extension> CreateHostedApp( |
| 104 bool is_unrestricted, bool is_from_webstore, const std::string& app_url) { |
| 105 return CreateTestExtension(is_unrestricted, is_from_webstore, kHostedApp, |
| 106 app_url); |
| 107 } |
| 108 |
| 66 TEST_F(ChromeContentRendererClientTest, NaClRestriction) { | 109 TEST_F(ChromeContentRendererClientTest, NaClRestriction) { |
| 67 // Unknown content types have no NaCl module. | 110 // Unknown content types have no NaCl module. |
| 68 { | 111 { |
| 69 WebPluginInfo info; | 112 WebPluginInfo info; |
| 70 EXPECT_EQ(GURL(), | 113 EXPECT_EQ(GURL(), |
| 71 ChromeContentRendererClient::GetNaClContentHandlerURL( | 114 ChromeContentRendererClient::GetNaClContentHandlerURL( |
| 72 "application/x-foo", info)); | 115 "application/x-foo", info)); |
| 73 } | 116 } |
| 74 // Known content types have a NaCl module. | 117 // Known content types have a NaCl module. |
| 75 { | 118 { |
| 76 WebPluginInfo info; | 119 WebPluginInfo info; |
| 77 AddContentTypeHandler(&info, "application/x-foo", "www.foo.com"); | 120 AddContentTypeHandler(&info, "application/x-foo", "www.foo.com"); |
| 78 EXPECT_EQ(GURL("www.foo.com"), | 121 EXPECT_EQ(GURL("www.foo.com"), |
| 79 ChromeContentRendererClient::GetNaClContentHandlerURL( | 122 ChromeContentRendererClient::GetNaClContentHandlerURL( |
| 80 "application/x-foo", info)); | 123 "application/x-foo", info)); |
| 81 } | 124 } |
| 82 // --enable-nacl allows all NaCl apps, with 'dev' interfaces. | 125 // --enable-nacl allows all NaCl apps, with 'dev' interfaces. |
| 83 { | 126 { |
| 84 WebPluginParams params; | 127 WebPluginParams params; |
| 85 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 128 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 86 GURL(), GURL(), kNaClUnrestricted, kExtensionRestricted, | 129 GURL(), GURL(), kNaClUnrestricted, |
| 87 kExtensionNotFromWebStore, ¶ms)); | 130 CreateExtension(kExtensionRestricted, kExtensionNotFromWebStore), |
| 131 ¶ms)); |
| 88 EXPECT_TRUE(AllowsDevInterfaces(params)); | 132 EXPECT_TRUE(AllowsDevInterfaces(params)); |
| 89 } | 133 } |
| 90 // Unrestricted extensions are allowed without --enable-nacl, with 'dev' | 134 // Unrestricted extensions are allowed without --enable-nacl, with 'dev' |
| 91 // interfaces if called from an extension url. | 135 // interfaces if called from an extension url. |
| 92 { | 136 { |
| 93 WebPluginParams params; | 137 WebPluginParams params; |
| 94 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 138 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 95 GURL(), GURL(kExtensionUrl), kNaClRestricted, | 139 GURL(), GURL(kExtensionUrl), kNaClRestricted, |
| 96 kExtensionUnrestricted, | 140 CreateExtension(kExtensionUnrestricted, kExtensionNotFromWebStore), |
| 97 kExtensionNotFromWebStore, ¶ms)); | 141 ¶ms)); |
| 98 EXPECT_TRUE(AllowsDevInterfaces(params)); | 142 EXPECT_TRUE(AllowsDevInterfaces(params)); |
| 99 } | 143 } |
| 100 // CWS extensions are allowed without --enable-nacl, without 'dev' | 144 // CWS extensions are allowed without --enable-nacl, without 'dev' |
| 101 // interfaces if called from an extension url. | 145 // interfaces if called from an extension url. |
| 102 { | 146 { |
| 103 WebPluginParams params; | 147 WebPluginParams params; |
| 104 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 148 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 105 GURL(), GURL(kExtensionUrl), kNaClRestricted, kExtensionRestricted, | 149 GURL(), GURL(kExtensionUrl), kNaClRestricted, |
| 106 kExtensionFromWebStore, ¶ms)); | 150 CreateExtension(kExtensionRestricted, kExtensionFromWebStore), |
| 151 ¶ms)); |
| 107 EXPECT_FALSE(AllowsDevInterfaces(params)); | 152 EXPECT_FALSE(AllowsDevInterfaces(params)); |
| 108 } | 153 } |
| 109 // CWS extensions can't get 'dev' interfaces with --enable-nacl. | 154 // CWS extensions can't get 'dev' interfaces with --enable-nacl. |
| 110 { | 155 { |
| 111 WebPluginParams params; | 156 WebPluginParams params; |
| 112 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 157 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 113 GURL(), GURL(kExtensionUrl), kNaClUnrestricted, kExtensionRestricted, | 158 GURL(), GURL(kExtensionUrl), kNaClUnrestricted, |
| 114 kExtensionFromWebStore, ¶ms)); | 159 CreateExtension(kExtensionRestricted, kExtensionFromWebStore), |
| 160 ¶ms)); |
| 115 EXPECT_FALSE(AllowsDevInterfaces(params)); | 161 EXPECT_FALSE(AllowsDevInterfaces(params)); |
| 116 } | 162 } |
| 117 // CWS extensions can't get 'dev' interfaces by injecting a fake | 163 // CWS extensions can't get 'dev' interfaces by injecting a fake |
| 118 // '@dev' attribute. | 164 // '@dev' attribute. |
| 119 { | 165 { |
| 120 WebPluginParams params; | 166 WebPluginParams params; |
| 121 AddFakeDevAttribute(¶ms); | 167 AddFakeDevAttribute(¶ms); |
| 122 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 168 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 123 GURL(), GURL(kExtensionUrl), kNaClRestricted, kExtensionRestricted, | 169 GURL(), GURL(kExtensionUrl), kNaClRestricted, |
| 124 kExtensionFromWebStore, ¶ms)); | 170 CreateExtension(kExtensionRestricted, kExtensionFromWebStore), |
| 171 ¶ms)); |
| 125 EXPECT_FALSE(AllowsDevInterfaces(params)); | 172 EXPECT_FALSE(AllowsDevInterfaces(params)); |
| 126 } | 173 } |
| 127 // The NaCl PDF extension is allowed without --enable-nacl, with 'dev' | 174 // The NaCl PDF extension is allowed without --enable-nacl, with 'dev' |
| 128 // interfaces, from all URLs. | 175 // interfaces, from all URLs. |
| 129 { | 176 { |
| 130 WebPluginParams params; | 177 WebPluginParams params; |
| 131 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 178 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 132 GURL("chrome-extension://acadkphlmlegjaadjagenfimbpphcgnh"), | 179 GURL("chrome-extension://acadkphlmlegjaadjagenfimbpphcgnh"), |
| 133 GURL(), kNaClRestricted, kExtensionRestricted, | 180 GURL(), kNaClRestricted, |
| 134 kExtensionFromWebStore, ¶ms)); | 181 CreateExtension(kExtensionRestricted, kExtensionFromWebStore), |
| 182 ¶ms)); |
| 135 EXPECT_TRUE(AllowsDevInterfaces(params)); | 183 EXPECT_TRUE(AllowsDevInterfaces(params)); |
| 136 } | 184 } |
| 137 // Whitelisted URLs are allowed without --enable-nacl, without 'dev' | 185 // Whitelisted URLs are allowed without --enable-nacl, without 'dev' |
| 138 // interfaces. | 186 // interfaces. |
| 139 { | 187 { |
| 140 WebPluginParams params; | 188 WebPluginParams params; |
| 141 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( | 189 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( |
| 142 GURL(), GURL("http://plus.google.com/games"), | 190 GURL(), GURL("http://plus.google.com/games"), |
| 143 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, | 191 kNaClRestricted, |
| 192 CreateExtension(kExtensionRestricted, kExtensionNotFromWebStore), |
| 144 ¶ms)); | 193 ¶ms)); |
| 145 EXPECT_FALSE(AllowsDevInterfaces(params)); | 194 EXPECT_FALSE(AllowsDevInterfaces(params)); |
| 146 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 195 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 147 GURL(), GURL("https://plus.google.com/games"), | 196 GURL(), GURL("https://plus.google.com/games"), |
| 148 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, | 197 kNaClRestricted, |
| 198 CreateExtension(kExtensionRestricted, kExtensionNotFromWebStore), |
| 149 ¶ms)); | 199 ¶ms)); |
| 150 EXPECT_FALSE(AllowsDevInterfaces(params)); | 200 EXPECT_FALSE(AllowsDevInterfaces(params)); |
| 151 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 201 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 152 GURL(), GURL("https://plus.google.com/games/209089085730"), | 202 GURL(), GURL("https://plus.google.com/games/209089085730"), |
| 153 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, | 203 kNaClRestricted, |
| 204 CreateExtension(kExtensionRestricted, kExtensionNotFromWebStore), |
| 154 ¶ms)); | 205 ¶ms)); |
| 155 EXPECT_FALSE(AllowsDevInterfaces(params)); | 206 EXPECT_FALSE(AllowsDevInterfaces(params)); |
| 156 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( | 207 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( |
| 157 GURL(), GURL("http://plus.sandbox.google.com/games"), | 208 GURL(), GURL("http://plus.sandbox.google.com/games"), |
| 158 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, | 209 kNaClRestricted, |
| 210 CreateExtension(kExtensionRestricted, kExtensionNotFromWebStore), |
| 159 ¶ms)); | 211 ¶ms)); |
| 160 EXPECT_FALSE(AllowsDevInterfaces(params)); | 212 EXPECT_FALSE(AllowsDevInterfaces(params)); |
| 161 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 213 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 162 GURL(), GURL("https://plus.sandbox.google.com/games"), | 214 GURL(), GURL("https://plus.sandbox.google.com/games"), |
| 163 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, | 215 kNaClRestricted, |
| 216 CreateExtension(kExtensionRestricted, kExtensionNotFromWebStore), |
| 164 ¶ms)); | 217 ¶ms)); |
| 165 EXPECT_FALSE(AllowsDevInterfaces(params)); | 218 EXPECT_FALSE(AllowsDevInterfaces(params)); |
| 166 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 219 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 167 GURL(), GURL("https://plus.google.com/games/209089085730"), | 220 GURL(), GURL("https://plus.google.com/games/209089085730"), |
| 168 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, | 221 kNaClRestricted, |
| 222 CreateExtension(kExtensionRestricted, kExtensionNotFromWebStore), |
| 169 ¶ms)); | 223 ¶ms)); |
| 170 EXPECT_FALSE(AllowsDevInterfaces(params)); | 224 EXPECT_FALSE(AllowsDevInterfaces(params)); |
| 171 } | 225 } |
| 172 // Whitelisted URLs can't get 'dev' interfaces with --enable-nacl. | 226 // Whitelisted URLs can't get 'dev' interfaces with --enable-nacl. |
| 173 { | 227 { |
| 174 WebPluginParams params; | 228 WebPluginParams params; |
| 175 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 229 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 176 GURL(), GURL("https://plus.google.com/games/209089085730"), | 230 GURL(), GURL("https://plus.google.com/games/209089085730"), |
| 177 kNaClUnrestricted, kExtensionRestricted, kExtensionNotFromWebStore, | 231 kNaClUnrestricted, |
| 232 CreateExtension(kExtensionRestricted, kExtensionNotFromWebStore), |
| 178 ¶ms)); | 233 ¶ms)); |
| 179 EXPECT_FALSE(AllowsDevInterfaces(params)); | 234 EXPECT_FALSE(AllowsDevInterfaces(params)); |
| 180 } | 235 } |
| 181 // Whitelisted URLs can't get 'dev' interfaces by injecting a fake | 236 // Whitelisted URLs can't get 'dev' interfaces by injecting a fake |
| 182 // '@dev' attribute. | 237 // '@dev' attribute. |
| 183 { | 238 { |
| 184 WebPluginParams params; | 239 WebPluginParams params; |
| 185 AddFakeDevAttribute(¶ms); | 240 AddFakeDevAttribute(¶ms); |
| 186 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( | 241 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 187 GURL(), GURL("https://plus.google.com/games/209089085730"), | 242 GURL(), GURL("https://plus.google.com/games/209089085730"), |
| 188 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, | 243 kNaClRestricted, |
| 244 CreateExtension(kExtensionRestricted, kExtensionNotFromWebStore), |
| 189 ¶ms)); | 245 ¶ms)); |
| 190 EXPECT_FALSE(AllowsDevInterfaces(params)); | 246 EXPECT_FALSE(AllowsDevInterfaces(params)); |
| 191 } | 247 } |
| 192 // Non-whitelisted URLs are blocked without --enable-nacl. | 248 // Non-whitelisted URLs are blocked without --enable-nacl. |
| 193 { | 249 { |
| 194 WebPluginParams params; | 250 WebPluginParams params; |
| 195 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( | 251 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( |
| 196 GURL(), GURL("https://plus.google.com.evil.com/games1"), | 252 GURL(), GURL("https://plus.google.com.evil.com/games1"), |
| 197 kNaClRestricted, kExtensionRestricted, kExtensionNotFromWebStore, | 253 kNaClRestricted, |
| 254 CreateExtension(kExtensionRestricted, kExtensionNotFromWebStore), |
| 198 ¶ms)); | 255 ¶ms)); |
| 199 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( | 256 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( |
| 200 GURL(), GURL("https://plus.google.com.evil.com/games2"), | 257 GURL(), GURL("https://plus.google.com.evil.com/games2"), |
| 201 kNaClRestricted, kExtensionRestricted, kExtensionFromWebStore, | 258 kNaClRestricted, |
| 259 CreateExtension(kExtensionRestricted, kExtensionFromWebStore), |
| 202 ¶ms)); | 260 ¶ms)); |
| 203 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( | 261 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( |
| 204 GURL(), GURL("https://plus.google.com.evil.com/games3"), | 262 GURL(), GURL("https://plus.google.com.evil.com/games3"), |
| 205 kNaClRestricted, kExtensionUnrestricted, kExtensionNotFromWebStore, | 263 kNaClRestricted, |
| 264 CreateExtension(kExtensionUnrestricted, kExtensionNotFromWebStore), |
| 206 ¶ms)); | 265 ¶ms)); |
| 207 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( | 266 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( |
| 208 GURL(), GURL("https://plus.google.com.evil.com/games4"), | 267 GURL(), GURL("https://plus.google.com.evil.com/games4"), |
| 209 kNaClRestricted, kExtensionUnrestricted, kExtensionFromWebStore, | 268 kNaClRestricted, |
| 269 CreateExtension(kExtensionUnrestricted, kExtensionFromWebStore), |
| 270 ¶ms)); |
| 271 } |
| 272 // Non chrome-extension:// URLs belonging to hosted apps are allowed. |
| 273 { |
| 274 WebPluginParams params; |
| 275 EXPECT_TRUE(ChromeContentRendererClient::IsNaClAllowed( |
| 276 GURL(), GURL("http://example.com/test.html"), |
| 277 kNaClRestricted, |
| 278 CreateHostedApp(kExtensionRestricted, kExtensionNotFromWebStore, |
| 279 "http://example.com/"), |
| 280 ¶ms)); |
| 281 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( |
| 282 GURL(), GURL("http://example.evil.com/test.html"), |
| 283 kNaClRestricted, |
| 284 CreateHostedApp(kExtensionRestricted, kExtensionNotFromWebStore, |
| 285 "http://example.com/"), |
| 210 ¶ms)); | 286 ¶ms)); |
| 211 } | 287 } |
| 212 } | 288 } |
| 213 | 289 |
| 214 } // namespace chrome | 290 } // namespace chrome |
| 215 | 291 |
| OLD | NEW |