OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // Test that absolute-looking paths ("/"-prefixed) are pasted correctly. | 182 // Test that absolute-looking paths ("/"-prefixed) are pasted correctly. |
183 EXPECT_EQ(extension->url().spec() + "test.html", | 183 EXPECT_EQ(extension->url().spec() + "test.html", |
184 extension->GetResourceURL("/test.html").spec()); | 184 extension->GetResourceURL("/test.html").spec()); |
185 } | 185 } |
186 | 186 |
187 TEST(ExtensionTest, GetAbsolutePathNoError) { | 187 TEST(ExtensionTest, GetAbsolutePathNoError) { |
188 scoped_refptr<Extension> extension = LoadManifestStrict("absolute_path", | 188 scoped_refptr<Extension> extension = LoadManifestStrict("absolute_path", |
189 "absolute.json"); | 189 "absolute.json"); |
190 EXPECT_TRUE(extension.get()); | 190 EXPECT_TRUE(extension.get()); |
191 std::string err; | 191 std::string err; |
192 std::vector<std::string> warnings; | 192 Extension::InstallWarningVector warnings; |
193 EXPECT_TRUE(extension_file_util::ValidateExtension(extension.get(), | 193 EXPECT_TRUE(extension_file_util::ValidateExtension(extension.get(), |
194 &err, &warnings)); | 194 &err, &warnings)); |
195 EXPECT_EQ(0U, warnings.size()); | 195 EXPECT_EQ(0U, warnings.size()); |
196 | 196 |
197 EXPECT_EQ(extension->path().AppendASCII("test.html").value(), | 197 EXPECT_EQ(extension->path().AppendASCII("test.html").value(), |
198 extension->GetResource("test.html").GetFilePath().value()); | 198 extension->GetResource("test.html").GetFilePath().value()); |
199 EXPECT_EQ(extension->path().AppendASCII("test.js").value(), | 199 EXPECT_EQ(extension->path().AppendASCII("test.js").value(), |
200 extension->GetResource("test.js").GetFilePath().value()); | 200 extension->GetResource("test.js").GetFilePath().value()); |
201 } | 201 } |
202 | 202 |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 } | 968 } |
969 | 969 |
970 TEST(ExtensionTest, GetSyncTypeExtensionWithTwoPlugins) { | 970 TEST(ExtensionTest, GetSyncTypeExtensionWithTwoPlugins) { |
971 scoped_refptr<Extension> extension( | 971 scoped_refptr<Extension> extension( |
972 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), | 972 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), |
973 Extension::INTERNAL, 2, FilePath())); | 973 Extension::INTERNAL, 2, FilePath())); |
974 if (extension) | 974 if (extension) |
975 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); | 975 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); |
976 } | 976 } |
977 #endif // !defined(OS_CHROMEOS) | 977 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |