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

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

Issue 13923007: Remove --allow-request-os-file-handle option (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unnecessary #include Created 7 years, 8 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
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 "chrome/common/extensions/extension.h" 8 #include "chrome/common/extensions/extension.h"
9 #include "chrome/common/extensions/extension_builder.h" 9 #include "chrome/common/extensions/extension_builder.h"
10 #include "chrome/common/extensions/extension_manifest_constants.h" 10 #include "chrome/common/extensions/extension_manifest_constants.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 &params)); 280 &params));
281 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed( 281 EXPECT_FALSE(ChromeContentRendererClient::IsNaClAllowed(
282 GURL(), GURL("http://example.evil.com/test.html"), 282 GURL(), GURL("http://example.evil.com/test.html"),
283 kNaClRestricted, 283 kNaClRestricted,
284 CreateHostedApp(kExtensionRestricted, kExtensionNotFromWebStore, 284 CreateHostedApp(kExtensionRestricted, kExtensionNotFromWebStore,
285 "http://example.com/"), 285 "http://example.com/"),
286 &params)); 286 &params));
287 } 287 }
288 } 288 }
289 289
290 TEST_F(ChromeContentRendererClientTest, IsRequestOSFileHandleAllowedForURL) {
291 ChromeContentRendererClient client;
292 const std::string& kWhitelistedExtensionID =
293 "dolnidnbiendbodmklboojlnlpdeeipo";
294 const std::string& kRandomExtensionID =
295 "abcdefghijklmnopqrstuvwxyzabcdef";
296 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(GURL()));
297 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
298 GURL("http://example.com/")));
299 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
300 GURL("chrome-extension://" + kWhitelistedExtensionID)));
301 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL(
302 GURL("filesystem:chrome-extension://" +
303 kWhitelistedExtensionID + "/foo")));
304 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
305 GURL("filesystem:http://" +
306 kWhitelistedExtensionID + "/foo")));
307 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
308 GURL("filesystem:chrome-extension://" +
309 kRandomExtensionID + "/foo")));
310 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
311 GURL("filesystem:http://127.0.0.1/foo")));
312
313 client.RegisterRequestOSFileHandleAllowedHosts(
314 "127.0.0.1," + kRandomExtensionID);
315 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL(
316 GURL("filesystem:chrome-extension://" +
317 kRandomExtensionID + "/foo")));
318 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL(
319 GURL("filesystem:http://127.0.0.1/foo")));
320 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
321 GURL("http://127.0.0.1/foo")));
322 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
323 GURL("filesystem:http://192.168.0.1/foo")));
324
325 client.RegisterRequestOSFileHandleAllowedHosts("127.0.0.?");
326 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL(
327 GURL("filesystem:http://127.0.0.1/foo")));
328 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL(
329 GURL("filesystem:http://127.0.0.2/foo")));
330 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
331 GURL("filesystem:http://127.0.1.0/foo")));
332
333 client.RegisterRequestOSFileHandleAllowedHosts("*");
334 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL(
335 GURL("filesystem:chrome-extension://" +
336 kRandomExtensionID + "/foo")));
337 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL(
338 GURL("filesystem:http://127.0.0.1/foo")));
339 EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
340 GURL("http://127.0.0.1/foo")));
341 EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL(
342 GURL("filesystem:http://192.168.0.1/foo")));
343 }
344
345 } // namespace chrome 290 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698