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

Unified Diff: chrome/browser/extensions/extensions_service_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_unittest.cc ('k') | chrome/browser/extensions/user_script_master.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extensions_service_unittest.cc
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index 19794a1125a90ee33550bd1dafa0d708cafaa48a..bfc5664b9e16638e13f38703ab587c890a93e4a0 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -78,7 +78,7 @@ typedef PlatformTest ExtensionsServiceTest;
TEST_F(ExtensionsServiceTest, LoadAllExtensionsFromDirectory) {
std::wstring extensions_dir;
ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_dir));
- FilePath manifest_path = FilePath::FromWStringHack(extensions_dir).Append(
+ FilePath extensions_path = FilePath::FromWStringHack(extensions_dir).Append(
FILE_PATH_LITERAL("extensions"));
scoped_refptr<ExtensionsServiceBackend> backend(new ExtensionsServiceBackend);
@@ -86,7 +86,7 @@ TEST_F(ExtensionsServiceTest, LoadAllExtensionsFromDirectory) {
new ExtensionsServiceTestFrontend);
std::vector<Extension*> extensions;
- EXPECT_TRUE(backend->LoadExtensionsFromDirectory(manifest_path,
+ EXPECT_TRUE(backend->LoadExtensionsFromDirectory(extensions_path,
scoped_refptr<ExtensionsServiceFrontendInterface>(frontend.get())));
frontend->GetMessageLoop()->RunAllPending();
@@ -101,11 +101,19 @@ TEST_F(ExtensionsServiceTest, LoadAllExtensionsFromDirectory) {
frontend->extensions()->at(0)->name());
EXPECT_EQ(std::string("The first extension that I made."),
frontend->extensions()->at(0)->description());
- ASSERT_EQ(2u, frontend->extensions()->at(0)->content_scripts().size());
- EXPECT_EQ(std::string("script1.user.js"),
- frontend->extensions()->at(0)->content_scripts().at(0));
- EXPECT_EQ(std::string("script2.user.js"),
- frontend->extensions()->at(0)->content_scripts().at(1));
+
+ Extension* extension = frontend->extensions()->at(0);
+ const UserScriptList& scripts = extension->user_scripts();
+ ASSERT_EQ(2u, scripts.size());
+ EXPECT_EQ(2u, scripts[0].matches.size());
+ EXPECT_EQ("http://*.google.com/*", scripts[0].matches[0]);
+ EXPECT_EQ("https://*.google.com/*", scripts[0].matches[1]);
+ EXPECT_EQ(extension->path().Append(FILE_PATH_LITERAL("script1.js")).value(),
+ scripts[0].path.value());
+ EXPECT_EQ(1u, scripts[1].matches.size());
+ EXPECT_EQ("http://*.yahoo.com/*", scripts[1].matches[0]);
+ EXPECT_EQ(extension->path().Append(FILE_PATH_LITERAL("script2.js")).value(),
+ scripts[1].path.value());
EXPECT_EQ(std::string("com.google.myextension2"),
frontend->extensions()->at(1)->id());
@@ -113,5 +121,5 @@ TEST_F(ExtensionsServiceTest, LoadAllExtensionsFromDirectory) {
frontend->extensions()->at(1)->name());
EXPECT_EQ(std::string(""),
frontend->extensions()->at(1)->description());
- ASSERT_EQ(0u, frontend->extensions()->at(1)->content_scripts().size());
+ ASSERT_EQ(0u, frontend->extensions()->at(1)->user_scripts().size());
};
« no previous file with comments | « chrome/browser/extensions/extension_unittest.cc ('k') | chrome/browser/extensions/user_script_master.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698