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

Side by Side Diff: chrome/browser/extensions/extension_protocols_unittest.cc

Issue 18352: Miscellaneous changes to Extension class in prep for user scripts (Closed)
Patch Set: be more paranoid about accessing string indexes than is probably warranted Created 11 years, 11 months 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_protocols.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 class ExtensionProtocolsTest : public testing::Test {
9 };
10
11 TEST(ExtensionProtocolsTest, 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""),
21 GetPathForExtensionResource(extension_path, "/../foo.gif").value());
22 #else
23 FilePath extension_path(FILE_PATH_LITERAL("/myextension"));
24 EXPECT_EQ(std::wstring("/myextension/foo/bar.gif"),
25 GetPathForExtensionResource(extension_path, "/foo/bar.gif").value()) ;
26 EXPECT_EQ(std::wstring("/myextension/"),
27 GetPathForExtensionResource(extension_path, "/").value());
28 EXPECT_EQ(std::wstring(""),
29 GetPathForExtensionResource(extension_path, "/../foo.gif").value());
30 #endif
31
32
33 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_protocols.cc ('k') | chrome/browser/extensions/extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698