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

Unified Diff: chrome/renderer/chrome_content_renderer_client_unittest.cc

Issue 13032002: Add RequestOSFileHandle as a private PPAPI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix test Created 7 years, 9 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/renderer/chrome_content_renderer_client_unittest.cc
diff --git a/chrome/renderer/chrome_content_renderer_client_unittest.cc b/chrome/renderer/chrome_content_renderer_client_unittest.cc
index 17f95df4fc00b0269d62bb12a3a63e442ffb1a26..e97fe1a97bd506d13eb7582020877667b7f617c3 100644
--- a/chrome/renderer/chrome_content_renderer_client_unittest.cc
+++ b/chrome/renderer/chrome_content_renderer_client_unittest.cc
@@ -287,5 +287,40 @@ TEST_F(ChromeContentRendererClientTest, NaClRestriction) {
}
}
-} // namespace chrome
+TEST_F(ChromeContentRendererClientTest, IsRequestOSFileHandleAllowedForURL) {
+ ChromeContentRendererClient client;
+ const std::string& kWhitelistedExtensionID =
+ "dolnidnbiendbodmklboojlnlpdeeipo";
+ const std::string& kRandomExtensionID =
+ "abcdefghijklmnopqrstuvwxyzabcdef";
+ EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(GURL()));
+ EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
+ GURL("http://example.com/")));
+ EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
+ GURL("chrome-extension://" + kWhitelistedExtensionID)));
+ EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL(
+ GURL("filesystem:chrome-extension://" +
+ kWhitelistedExtensionID + "/foo")));
+ EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
+ GURL("filesystem:http://" +
+ kWhitelistedExtensionID + "/foo")));
+ EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
+ GURL("filesystem:chrome-extension://" +
+ kRandomExtensionID + "/foo")));
+ EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
+ GURL("filesystem:http://127.0.0.1/foo")));
+
+ client.RegisterRequestOSFileHandleAllowedHosts(
+ "127.0.0.1," + kRandomExtensionID);
+ EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL(
+ GURL("filesystem:chrome-extension://" +
+ kRandomExtensionID + "/foo")));
+ EXPECT_TRUE(client.IsRequestOSFileHandleAllowedForURL(
+ GURL("filesystem:http://127.0.0.1/foo")));
+ EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
+ GURL("http://127.0.0.1/foo")));
+ EXPECT_FALSE(client.IsRequestOSFileHandleAllowedForURL(
+ GURL("filesystem:http://192.168.0.1/foo")));
+}
+} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698