| 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
|
|
|