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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/extension_protocol.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 class ExtensionProtocolTest : public testing::Test {
9 };
10
11 TEST(ExtensionProtocolTest, GetPathForExtensionResource) {
12 #if defined(OS_WIN)
13 FilePath extension_path(FILE_PATH_LITERAL("C:\\myextension"));
14 EXPECT_EQ(std::wstring(L"C:\\myextension\\foo\\bar.gif"),
15 GetPathForExtensionResource(extension_path, "/foo/bar.gif").value()) ;
16 EXPECT_EQ(std::wstring(L"C:\\myextension\\"),
17 GetPathForExtensionResource(extension_path, "/").value());
18 EXPECT_EQ(std::wstring(L"C:\\myextension\\c:\\foo.gif"),
19 GetPathForExtensionResource(extension_path, "/c:/foo.gif").value());
20 EXPECT_EQ(std::wstring(L"C:\\myextension\\\\foo.gif"),
21 GetPathForExtensionResource(extension_path, "//foo.gif").value());
22 EXPECT_EQ(std::wstring(L""),
23 GetPathForExtensionResource(extension_path, "/../foo.gif").value());
24 #else
25 FilePath extension_path(FILE_PATH_LITERAL("/myextension"));
26 EXPECT_EQ(std::wstring("/myextension/foo/bar.gif"),
27 GetPathForExtensionResource(extension_path, "/foo/bar.gif").value()) ;
28 EXPECT_EQ(std::wstring("/myextension/"),
29 GetPathForExtensionResource(extension_path, "/").value());
30 EXPECT_EQ(std::wstring("/myextension//foo.gif"),
31 GetPathForExtensionResource(extension_path, "//foo.gif").value());
32 EXPECT_EQ(std::wstring(""),
33 GetPathForExtensionResource(extension_path, "/../foo.gif").value());
34 #endif
35
36
37 }
OLDNEW
« 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