diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-24 00:21:26 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-24 00:21:26 +0000 |
commit | 828912619a537bf7a33a36c2441d922a7639bc9b (patch) | |
tree | 6c49122fa2a1d04ba8b3b65705bd6fbf23b3d34e /chrome/browser/extensions/extension_protocol_unittest.cc | |
parent | ed1ff5e175dbc151aa7999e2c7b79a82c8ff7052 (diff) | |
download | chromium_src-828912619a537bf7a33a36c2441d922a7639bc9b.zip chromium_src-828912619a537bf7a33a36c2441d922a7639bc9b.tar.gz chromium_src-828912619a537bf7a33a36c2441d922a7639bc9b.tar.bz2 |
Implement extension:// protocol.
Review URL: http://codereview.chromium.org/15010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7462 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_protocol_unittest.cc')
-rw-r--r-- | chrome/browser/extensions/extension_protocol_unittest.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_protocol_unittest.cc b/chrome/browser/extensions/extension_protocol_unittest.cc new file mode 100644 index 0000000..1d2b4f2 --- /dev/null +++ b/chrome/browser/extensions/extension_protocol_unittest.cc @@ -0,0 +1,39 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/extension_protocol.h" +#include "testing/gtest/include/gtest/gtest.h" + +class ExtensionProtocolTest : public testing::Test { +}; + +TEST(ExtensionProtocolTest, GetPathForExtensionResource) { +#if defined(OS_WIN) + FilePath extension_path(FILE_PATH_LITERAL("C:\\myextension")); + EXPECT_EQ(std::wstring(L"C:\\myextension\\foo\\bar.gif"), + GetPathForExtensionResource(extension_path, "/foo/bar.gif").value()); + EXPECT_EQ(std::wstring(L"C:\\myextension\\"), + GetPathForExtensionResource(extension_path, "/").value()); + // TODO(aa): This one is a bit weird, but is what net::FileURLToFilePath() + // returns for this input. Investigate adding more validation. + EXPECT_EQ(std::wstring(L"C:\\myextension\\c:\\foo.gif"), + GetPathForExtensionResource(extension_path, "/c:/foo.gif").value()); + EXPECT_EQ(std::wstring(L"C:\\myextension\\foo.gif"), + GetPathForExtensionResource(extension_path, "//foo.gif").value()); + EXPECT_EQ(std::wstring(L""), + GetPathForExtensionResource(extension_path, "/../foo.gif").value()); +#else + FilePath extension_path(FILE_PATH_LITERAL("/myextension")); + EXPECT_EQ(std::wstring("/myextension/foo/bar.gif"), + GetPathForExtensionResource(extension_path, "/foo/bar.gif").value()); + EXPECT_EQ(std::wstring("/myextension/"), + GetPathForExtensionResource(extension_path, "/").value()); + EXPECT_EQ(std::wstring("/myextension/foo.gif"), + GetPathForExtensionResource(extension_path, "//foo.gif").value()); + EXPECT_EQ(std::wstring(""), + GetPathForExtensionResource(extension_path, "/../foo.gif").value()); +#endif + + +} |