| Index: extensions/common/file_util_unittest.cc
|
| diff --git a/extensions/common/file_util_unittest.cc b/extensions/common/file_util_unittest.cc
|
| index c3b588cf33128dace8f74154dd9c5177b52e687f..5be68fa52d216d22dc6b0c3bb11f18ab2fab6da7 100644
|
| --- a/extensions/common/file_util_unittest.cc
|
| +++ b/extensions/common/file_util_unittest.cc
|
| @@ -483,69 +483,4 @@ TEST_F(FileUtilTest, ExtensionURLToRelativeFilePath) {
|
| }
|
| }
|
|
|
| -TEST_F(FileUtilTest, ExtensionResourceURLToFilePath) {
|
| - // Setup filesystem for testing.
|
| - base::FilePath root_path;
|
| - ASSERT_TRUE(base::CreateNewTempDirectory(
|
| - base::FilePath::StringType(), &root_path));
|
| - root_path = base::MakeAbsoluteFilePath(root_path);
|
| - ASSERT_FALSE(root_path.empty());
|
| -
|
| - base::FilePath api_path = root_path.Append(FILE_PATH_LITERAL("apiname"));
|
| - ASSERT_TRUE(base::CreateDirectory(api_path));
|
| -
|
| - const char data[] = "Test Data";
|
| - base::FilePath resource_path = api_path.Append(FILE_PATH_LITERAL("test.js"));
|
| - ASSERT_TRUE(base::WriteFile(resource_path, data, sizeof(data)));
|
| - resource_path = api_path.Append(FILE_PATH_LITERAL("escape spaces.js"));
|
| - ASSERT_TRUE(base::WriteFile(resource_path, data, sizeof(data)));
|
| - resource_path = api_path.Append(FILE_PATH_LITERAL("escape spaces.js"));
|
| - ASSERT_TRUE(base::WriteFile(resource_path, data, sizeof(data)));
|
| - resource_path = api_path.Append(FILE_PATH_LITERAL("..%2f..%2fsimple.html"));
|
| - ASSERT_TRUE(base::WriteFile(resource_path, data, sizeof(data)));
|
| -
|
| -#ifdef FILE_PATH_USES_WIN_SEPARATORS
|
| -#define SEP "\\"
|
| -#else
|
| -#define SEP "/"
|
| -#endif
|
| -#define URL_PREFIX "chrome-extension-resource://"
|
| - struct TestCase {
|
| - const char* url;
|
| - const base::FilePath::CharType* expected_path;
|
| - } test_cases[] = {
|
| - {URL_PREFIX "apiname/test.js", FILE_PATH_LITERAL("test.js")},
|
| - {URL_PREFIX "/apiname/test.js", FILE_PATH_LITERAL("test.js")},
|
| - // Test % escape
|
| - {URL_PREFIX "apiname/%74%65st.js", FILE_PATH_LITERAL("test.js")},
|
| - {URL_PREFIX "apiname/escape%20spaces.js",
|
| - FILE_PATH_LITERAL("escape spaces.js")},
|
| - // Test file does not exist.
|
| - {URL_PREFIX "apiname/directory/to/file.js", NULL},
|
| - // Test apiname/../../test.js
|
| - {URL_PREFIX "apiname/../../test.js", FILE_PATH_LITERAL("test.js")},
|
| - {URL_PREFIX "apiname/..%2F../test.js", NULL},
|
| - {URL_PREFIX "apiname/f/../../../test.js", FILE_PATH_LITERAL("test.js")},
|
| - {URL_PREFIX "apiname/f%2F..%2F..%2F../test.js", NULL},
|
| - {URL_PREFIX "apiname/..%2f..%2fsimple.html",
|
| - FILE_PATH_LITERAL("..%2f..%2fsimple.html")},
|
| - };
|
| -#undef SEP
|
| -#undef URL_PREFIX
|
| -
|
| - for (size_t i = 0; i < arraysize(test_cases); ++i) {
|
| - GURL url(test_cases[i].url);
|
| - base::FilePath expected_path;
|
| - if (test_cases[i].expected_path)
|
| - expected_path = root_path.Append(FILE_PATH_LITERAL("apiname")).Append(
|
| - test_cases[i].expected_path);
|
| - base::FilePath actual_path =
|
| - extensions::file_util::ExtensionResourceURLToFilePath(url, root_path);
|
| - EXPECT_EQ(expected_path.value(), actual_path.value()) <<
|
| - " For the path " << url;
|
| - }
|
| - // Remove temp files.
|
| - ASSERT_TRUE(base::DeleteFile(root_path, true));
|
| -}
|
| -
|
| } // namespace extensions
|
|
|