diff options
author | mad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-28 12:41:29 +0000 |
---|---|---|
committer | mad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-28 12:41:29 +0000 |
commit | a14b16bd4b6d7fc3c1e3e83f16d1d59bc05f3dab (patch) | |
tree | b9f147f90989125906bc77282d41f166c57bb959 /chrome/browser/extensions | |
parent | c3b4463c325d5a7f512130c02a68913cc52d20fe (diff) | |
download | chromium_src-a14b16bd4b6d7fc3c1e3e83f16d1d59bc05f3dab.zip chromium_src-a14b16bd4b6d7fc3c1e3e83f16d1d59bc05f3dab.tar.gz chromium_src-a14b16bd4b6d7fc3c1e3e83f16d1d59bc05f3dab.tar.bz2 |
Get rid of FilePath::AppendAndResolveRelative().
To resolve the problem of '..' parent references as well as symbolic links on POSIX platforms, we can simply use the file_util::AbsolutePath() function.
This has the drawback of having a different behavior on Windows and POSIX platforms, in the way that it can return a canonical path that doesn't exists when ran on Windows, but it will return an empty path (or false) when run on a POSIX platform.
So we need to add an extra PathExists() call to unify the behavior.
BUG=25681,25131
Review URL: http://codereview.chromium.org/343003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30334 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/extensions_service_unittest.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index 45cad68..e6ed987 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -542,19 +542,23 @@ TEST_F(ExtensionsServiceTest, LoadAllExtensionsFromDirectorySuccess) { EXPECT_EQ(2u, scripts[0].js_scripts().size()); ExtensionResource resource00(scripts[0].js_scripts()[0].extension_root(), scripts[0].js_scripts()[0].relative_path()); - EXPECT_TRUE(resource00.ComparePathWithDefault( - extension->path().AppendASCII("script1.js"))); + FilePath expected_path(extension->path().AppendASCII("script1.js")); + ASSERT_TRUE(file_util::AbsolutePath(&expected_path)); + EXPECT_TRUE(resource00.ComparePathWithDefault(expected_path)); ExtensionResource resource01(scripts[0].js_scripts()[1].extension_root(), scripts[0].js_scripts()[1].relative_path()); - EXPECT_TRUE(resource01.ComparePathWithDefault( - extension->path().AppendASCII("script2.js"))); + expected_path = extension->path().AppendASCII("script2.js"); + ASSERT_TRUE(file_util::AbsolutePath(&expected_path)); + EXPECT_TRUE(resource01.ComparePathWithDefault(expected_path)); EXPECT_TRUE(extension->plugins().empty()); EXPECT_EQ(1u, scripts[1].url_patterns().size()); EXPECT_EQ("http://*.news.com/*", scripts[1].url_patterns()[0].GetAsString()); ExtensionResource resource10(scripts[1].js_scripts()[0].extension_root(), scripts[1].js_scripts()[0].relative_path()); - EXPECT_TRUE(resource10.ComparePathWithDefault( - extension->path().AppendASCII("js_files").AppendASCII("script3.js"))); + expected_path = + extension->path().AppendASCII("js_files").AppendASCII("script3.js"); + ASSERT_TRUE(file_util::AbsolutePath(&expected_path)); + EXPECT_TRUE(resource10.ComparePathWithDefault(expected_path)); const std::vector<URLPattern> permissions = extension->host_permissions(); ASSERT_EQ(2u, permissions.size()); EXPECT_EQ("http://*.google.com/*", permissions[0].GetAsString()); |