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

Unified Diff: chrome/browser/extensions/extension_protocol_unittest.cc

Issue 15010: Implement extension:// protocol. (Closed)
Patch Set: add missing unit test Created 12 years 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
« no previous file with comments | « chrome/browser/extensions/extension_protocol.cc ('k') | chrome/browser/extensions/extensions_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_protocol_unittest.cc
diff --git a/chrome/browser/extensions/extension_protocol_unittest.cc b/chrome/browser/extensions/extension_protocol_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..995fb0d44465677f3ca5bf1e9d9367d599897d75
--- /dev/null
+++ b/chrome/browser/extensions/extension_protocol_unittest.cc
@@ -0,0 +1,37 @@
+// 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());
+ 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
+
+
+}
« no previous file with comments | « chrome/browser/extensions/extension_protocol.cc ('k') | chrome/browser/extensions/extensions_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698