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

Unified Diff: chrome/common/extensions/extension_manifests_unittest.cc

Issue 9150008: Introduce background.scripts feature for extension manifests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready to land Created 8 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
Index: chrome/common/extensions/extension_manifests_unittest.cc
diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc
index 02bb9930fe9bbabcd576e2cf379dea957a4d9df3..f8089e21a8b61472ee7a8d6fb273042f93652c60 100644
--- a/chrome/common/extensions/extension_manifests_unittest.cc
+++ b/chrome/common/extensions/extension_manifests_unittest.cc
@@ -984,7 +984,7 @@ TEST_F(ExtensionManifestTest, BackgroundPage) {
scoped_refptr<Extension> extension(
LoadAndExpectSuccess("background_page.json"));
ASSERT_TRUE(extension);
- EXPECT_EQ("/foo.html", extension->background_url().path());
+ EXPECT_EQ("/foo.html", extension->GetBackgroundURL().path());
std::string error;
scoped_ptr<DictionaryValue> manifest(
@@ -992,12 +992,35 @@ TEST_F(ExtensionManifestTest, BackgroundPage) {
ASSERT_TRUE(manifest.get());
extension = LoadAndExpectSuccess(Manifest(manifest.get(), ""));
ASSERT_TRUE(extension);
- EXPECT_EQ("/foo.html", extension->background_url().path());
+ EXPECT_EQ("/foo.html", extension->GetBackgroundURL().path());
manifest->SetInteger(keys::kManifestVersion, 2);
extension = LoadAndExpectSuccess(Manifest(manifest.get(), ""));
ASSERT_TRUE(extension);
- EXPECT_FALSE(extension->background_url().is_valid());
+ EXPECT_FALSE(extension->GetBackgroundURL().is_valid());
+}
+
+TEST_F(ExtensionManifestTest, BackgroundScripts) {
+ std::string error;
+ scoped_ptr<DictionaryValue> manifest(
+ LoadManifestFile("background_scripts.json", &error));
+ ASSERT_TRUE(manifest.get());
+
+ scoped_refptr<Extension> extension(
+ LoadAndExpectSuccess(Manifest(manifest.get(), "")));
+ ASSERT_TRUE(extension);
+ EXPECT_EQ(2u, extension->background_scripts().size());
+ EXPECT_EQ("foo.js", extension->background_scripts()[0u]);
+ EXPECT_EQ("bar/baz.js", extension->background_scripts()[1u]);
+
+ EXPECT_TRUE(extension->has_background_page());
+ EXPECT_EQ(std::string("/") +
+ extension_filenames::kGeneratedBackgroundPageFilename,
+ extension->GetBackgroundURL().path());
+
+ manifest->SetString("background_page", "monkey.html");
+ LoadAndExpectError(Manifest(manifest.get(), ""),
+ errors::kInvalidBackgroundCombination);
}
TEST_F(ExtensionManifestTest, PageActionManifestVersion2) {
« no previous file with comments | « chrome/common/extensions/extension_file_util_unittest.cc ('k') | chrome/test/data/extensions/api_test/alert/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698