summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/extensions')
-rw-r--r--chrome/common/extensions/api/commands/commands_manifest_unittest.cc2
-rw-r--r--chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc2
-rw-r--r--chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc2
-rw-r--r--chrome/common/extensions/api/i18n/default_locale_manifest_unittest.cc6
-rw-r--r--chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc2
-rw-r--r--chrome/common/extensions/extension_file_util_unittest.cc4
-rw-r--r--chrome/common/extensions/extension_unittest.cc2
-rw-r--r--chrome/common/extensions/manifest_handler.cc120
-rw-r--r--chrome/common/extensions/manifest_handler.h13
-rw-r--r--chrome/common/extensions/manifest_handler_unittest.cc190
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifest_test.cc5
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifest_test.h5
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc1
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc2
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc10
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc4
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc1
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc5
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc5
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_ui_unittest.cc2
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc5
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc2
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_web_intents_unittest.cc5
-rw-r--r--chrome/common/extensions/unpacker_unittest.cc5
24 files changed, 352 insertions, 48 deletions
diff --git a/chrome/common/extensions/api/commands/commands_manifest_unittest.cc b/chrome/common/extensions/api/commands/commands_manifest_unittest.cc
index 38c32a0..9a27c39 100644
--- a/chrome/common/extensions/api/commands/commands_manifest_unittest.cc
+++ b/chrome/common/extensions/api/commands/commands_manifest_unittest.cc
@@ -20,7 +20,7 @@ class CommandsManifestTest : public ExtensionManifestTest {
protected:
virtual void SetUp() OVERRIDE {
ManifestHandler::Register(extension_manifest_keys::kCommands,
- new CommandsHandler);
+ make_linked_ptr(new CommandsHandler));
}
};
diff --git a/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc b/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc
index 01ead27..338a2d9 100644
--- a/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc
+++ b/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc
@@ -23,7 +23,7 @@ class BrowserActionManifestTest : public ExtensionManifestTest {
virtual void SetUp() OVERRIDE {
ExtensionManifestTest::SetUp();
ManifestHandler::Register(extension_manifest_keys::kBrowserAction,
- new BrowserActionHandler);
+ make_linked_ptr(new BrowserActionHandler));
}
};
diff --git a/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc b/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc
index bfc4afc..605499c 100644
--- a/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc
+++ b/chrome/common/extensions/api/extension_action/script_badge_manifest_unittest.cc
@@ -35,7 +35,7 @@ class ScriptBadgeManifestTest : public ExtensionManifestTest {
protected:
virtual void SetUp() OVERRIDE {
ManifestHandler::Register(extension_manifest_keys::kScriptBadge,
- new ScriptBadgeHandler);
+ make_linked_ptr(new ScriptBadgeHandler));
}
};
diff --git a/chrome/common/extensions/api/i18n/default_locale_manifest_unittest.cc b/chrome/common/extensions/api/i18n/default_locale_manifest_unittest.cc
index 645a3ff..c387d8a 100644
--- a/chrome/common/extensions/api/i18n/default_locale_manifest_unittest.cc
+++ b/chrome/common/extensions/api/i18n/default_locale_manifest_unittest.cc
@@ -13,14 +13,14 @@ namespace extensions {
class DefaultLocaleManifestTest : public ExtensionManifestTest {
virtual void SetUp() OVERRIDE {
ExtensionManifestTest::SetUp();
- ManifestHandler::Register(keys::kDefaultLocale,
- new DefaultLocaleHandler);
+ ManifestHandler::Register(extension_manifest_keys::kDefaultLocale,
+ make_linked_ptr(new DefaultLocaleHandler));
}
};
TEST_F(DefaultLocaleManifestTest, DefaultLocale) {
LoadAndExpectError("default_locale_invalid.json",
- errors::kInvalidDefaultLocale);
+ extension_manifest_errors::kInvalidDefaultLocale);
scoped_refptr<Extension> extension(
LoadAndExpectSuccess("default_locale_valid.json"));
diff --git a/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc b/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc
index d18bb66..d056d70 100644
--- a/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc
+++ b/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc
@@ -16,7 +16,7 @@ class OAuth2ManifestTest : public ExtensionManifestTest {
protected:
virtual void SetUp() OVERRIDE {
ManifestHandler::Register(extension_manifest_keys::kOAuth2,
- new OAuth2ManifestHandler);
+ make_linked_ptr(new OAuth2ManifestHandler));
}
};
diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc
index d6c3931..ffd2eb0 100644
--- a/chrome/common/extensions/extension_file_util_unittest.cc
+++ b/chrome/common/extensions/extension_file_util_unittest.cc
@@ -33,10 +33,10 @@ class ExtensionFileUtilTest : public testing::Test {
testing::Test::SetUp();
extensions::ManifestHandler::Register(
extension_manifest_keys::kBrowserAction,
- new extensions::BrowserActionHandler);
+ make_linked_ptr(new extensions::BrowserActionHandler));
extensions::ManifestHandler::Register(
keys::kDefaultLocale,
- new extensions::DefaultLocaleHandler);
+ make_linked_ptr(new extensions::DefaultLocaleHandler));
}
};
diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc
index e6a891b..9eec106 100644
--- a/chrome/common/extensions/extension_unittest.cc
+++ b/chrome/common/extensions/extension_unittest.cc
@@ -126,7 +126,7 @@ class ExtensionTest : public testing::Test {
protected:
virtual void SetUp() OVERRIDE {
ManifestHandler::Register(extension_manifest_keys::kCommands,
- new CommandsHandler);
+ make_linked_ptr(new CommandsHandler));
}
};
diff --git a/chrome/common/extensions/manifest_handler.cc b/chrome/common/extensions/manifest_handler.cc
index c1c7613..389f4f5 100644
--- a/chrome/common/extensions/manifest_handler.cc
+++ b/chrome/common/extensions/manifest_handler.cc
@@ -7,7 +7,8 @@
#include <map>
#include "base/lazy_instance.h"
-#include "base/memory/linked_ptr.h"
+#include "base/logging.h"
+#include "base/stl_util.h"
#include "chrome/common/extensions/manifest.h"
namespace extensions {
@@ -16,48 +17,128 @@ namespace {
class ManifestHandlerRegistry {
public:
+ ManifestHandlerRegistry() : is_sorted_(false) {
+ }
+
void RegisterManifestHandler(const std::string& key,
- ManifestHandler* handler);
+ linked_ptr<ManifestHandler> handler);
bool ParseExtension(Extension* extension, string16* error);
+ void ClearForTesting();
private:
friend struct base::DefaultLazyInstanceTraits<ManifestHandlerRegistry>;
typedef std::map<std::string, linked_ptr<ManifestHandler> >
ManifestHandlerMap;
+ typedef std::map<ManifestHandler*, int> ManifestHandlerPriorityMap;
+
+ // Puts the manifest handlers in order such that each handler comes after
+ // any handlers for their PrerequisiteKeys. If there is no handler for
+ // a prerequisite key, that dependency is simply ignored.
+ // CHECKs that there are no manifest handlers with circular dependencies.
+ void SortManifestHandlers();
+ // All registered manifest handlers.
ManifestHandlerMap handlers_;
+
+ // The priority for each manifest handler. Handlers with lower priority
+ // values are evaluated first.
+ ManifestHandlerPriorityMap priority_map_;
+ bool is_sorted_;
};
void ManifestHandlerRegistry::RegisterManifestHandler(
- const std::string& key, ManifestHandler* handler) {
- handlers_[key] = make_linked_ptr(handler);
+ const std::string& key, linked_ptr<ManifestHandler> handler) {
+ handlers_[key] = handler;
+ is_sorted_ = false;
}
bool ManifestHandlerRegistry::ParseExtension(Extension* extension,
string16* error) {
- std::set<ManifestHandler*> handler_set;
+ SortManifestHandlers();
+ std::map<int, ManifestHandler*> handlers_by_priority;
for (ManifestHandlerMap::iterator iter = handlers_.begin();
iter != handlers_.end(); ++iter) {
ManifestHandler* handler = iter->second.get();
if (extension->manifest()->HasPath(iter->first) ||
- handler->AlwaysParseForType(extension->GetType()))
- handler_set.insert(handler);
+ handler->AlwaysParseForType(extension->GetType())) {
+ handlers_by_priority[priority_map_[handler]] = handler;
+ }
}
-
- // TODO(yoz): Some handlers may depend on other handlers having already
- // parsed their keys. Reorder the handlers so that handlers needed earlier
- // come first in the returned container.
- for (std::set<ManifestHandler*>::iterator iter = handler_set.begin();
- iter != handler_set.end(); ++iter) {
- if (!(*iter)->Parse(extension, error))
+ for (std::map<int, ManifestHandler*>::iterator iter =
+ handlers_by_priority.begin();
+ iter != handlers_by_priority.end(); ++iter) {
+ if (!(iter->second)->Parse(extension, error))
return false;
}
return true;
}
+void ManifestHandlerRegistry::ClearForTesting() {
+ priority_map_.clear();
+ handlers_.clear();
+ is_sorted_ = false;
+}
+
+void ManifestHandlerRegistry::SortManifestHandlers() {
+ if (is_sorted_)
+ return;
+
+ // Forget our existing sort order.
+ priority_map_.clear();
+ std::set<ManifestHandler*> unsorted_handlers;
+ for (ManifestHandlerMap::const_iterator iter = handlers_.begin();
+ iter != handlers_.end(); ++iter) {
+ unsorted_handlers.insert(iter->second.get());
+ }
+
+ int priority = 0;
+ while (true) {
+ std::set<ManifestHandler*> next_unsorted_handlers;
+ for (std::set<ManifestHandler*>::const_iterator iter =
+ unsorted_handlers.begin();
+ iter != unsorted_handlers.end(); ++iter) {
+ ManifestHandler* handler = *iter;
+ const std::vector<std::string>& prerequisites =
+ handler->PrerequisiteKeys();
+ int unsatisfied = prerequisites.size();
+ for (size_t i = 0; i < prerequisites.size(); ++i) {
+ ManifestHandlerMap::const_iterator prereq_iter =
+ handlers_.find(prerequisites[i]);
+ // If the prerequisite does not exist, crash.
+ CHECK(prereq_iter != handlers_.end())
+ << "Extension manifest handler depends on unrecognized key "
+ << prerequisites[i];
+ // Prerequisite is in our map.
+ if (ContainsKey(priority_map_, prereq_iter->second.get()))
+ unsatisfied--;
+ }
+ if (unsatisfied == 0) {
+ priority_map_[handler] = priority;
+ priority++;
+ } else {
+ // Put in the list for next time.
+ next_unsorted_handlers.insert(handler);
+ }
+ }
+ if (next_unsorted_handlers.size() == unsorted_handlers.size())
+ break;
+ unsorted_handlers.swap(next_unsorted_handlers);
+ }
+
+ // If there are any leftover unsorted handlers, they must have had
+ // circular dependencies.
+ CHECK(unsorted_handlers.size() == 0) << "Extension manifest handlers have "
+ << "circular dependencies!";
+
+ is_sorted_ = true;
+}
+
static base::LazyInstance<ManifestHandlerRegistry> g_registry =
LAZY_INSTANCE_INITIALIZER;
+static base::LazyInstance<std::vector<std::string> > g_empty_string_vector =
+ LAZY_INSTANCE_INITIALIZER;
+
} // namespace
ManifestHandler::ManifestHandler() {
@@ -70,9 +151,13 @@ bool ManifestHandler::AlwaysParseForType(Manifest::Type type) {
return false;
}
+const std::vector<std::string>& ManifestHandler::PrerequisiteKeys() {
+ return g_empty_string_vector.Get();
+}
+
// static
void ManifestHandler::Register(const std::string& key,
- ManifestHandler* handler) {
+ linked_ptr<ManifestHandler> handler) {
g_registry.Get().RegisterManifestHandler(key, handler);
}
@@ -81,4 +166,9 @@ bool ManifestHandler::ParseExtension(Extension* extension, string16* error) {
return g_registry.Get().ParseExtension(extension, error);
}
+// static
+void ManifestHandler::ClearRegistryForTesting() {
+ g_registry.Get().ClearForTesting();
+}
+
} // namespace extensions
diff --git a/chrome/common/extensions/manifest_handler.h b/chrome/common/extensions/manifest_handler.h
index 22c1a17..63380c7 100644
--- a/chrome/common/extensions/manifest_handler.h
+++ b/chrome/common/extensions/manifest_handler.h
@@ -8,6 +8,7 @@
#include <set>
#include <string>
+#include "base/memory/linked_ptr.h"
#include "base/string16.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/manifest.h"
@@ -32,17 +33,27 @@ class ManifestHandler {
// TODO(yoz): Use Feature availability instead.
virtual bool AlwaysParseForType(Manifest::Type type);
+ // The list of keys that, if present, should be parsed before calling our
+ // Parse (typically, because our Parse needs to read those keys).
+ // Defaults to empty.
+ virtual const std::vector<std::string>& PrerequisiteKeys();
+
// Associate |handler| with |key| in the manifest. A handler can register
// for multiple keys. The global registry takes ownership of |handler|;
// if it has an existing handler for |key|, it replaces it with this one.
//
// WARNING: Manifest handlers registered only in the browser process
// are not available to renderers or utility processes.
- static void Register(const std::string& key, ManifestHandler* handler);
+ static void Register(const std::string& key,
+ linked_ptr<ManifestHandler> handler);
// Call Parse on all registered manifest handlers that should parse
// this extension.
static bool ParseExtension(Extension* extension, string16* error);
+
+ // Reset the manifest handler registry to an empty state. Useful for
+ // unit tests.
+ static void ClearRegistryForTesting();
};
} // namespace extensions
diff --git a/chrome/common/extensions/manifest_handler_unittest.cc b/chrome/common/extensions/manifest_handler_unittest.cc
new file mode 100644
index 0000000..83116c2
--- /dev/null
+++ b/chrome/common/extensions/manifest_handler_unittest.cc
@@ -0,0 +1,190 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <string>
+#include <vector>
+
+#include "base/file_path.h"
+#include "base/stl_util.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_builder.h"
+#include "chrome/common/extensions/manifest_handler.h"
+#include "chrome/common/extensions/value_builder.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace extensions {
+
+class ManifestHandlerTest : public testing::Test {
+ public:
+ class ParsingWatcher {
+ public:
+ // Called when a manifest handler parses.
+ void Record(const std::string& name) {
+ parsed_names_.push_back(name);
+ }
+
+ const std::vector<std::string>& parsed_names() {
+ return parsed_names_;
+ }
+
+ // Returns true if |name_before| was parsed before |name_after|.
+ bool ParsedBefore(const std::string& name_before,
+ const std::string& name_after) {
+ size_t i_before = parsed_names_.size();
+ size_t i_after = 0;
+ for (size_t i = 0; i < parsed_names_.size(); ++i) {
+ if (parsed_names_[i] == name_before)
+ i_before = i;
+ if (parsed_names_[i] == name_after)
+ i_after = i;
+ }
+ if (i_before < i_after)
+ return true;
+ return false;
+ }
+
+ private:
+ // The order of manifest handlers that we watched parsing.
+ std::vector<std::string> parsed_names_;
+ };
+
+ class TestManifestHandler : public ManifestHandler {
+ public:
+ TestManifestHandler(const std::string& name,
+ const std::vector<std::string>& prereqs,
+ ParsingWatcher* watcher)
+ : name_(name), prereqs_(prereqs), watcher_(watcher) {
+ }
+
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE {
+ watcher_->Record(name_);
+ return true;
+ }
+
+ virtual const std::vector<std::string>& PrerequisiteKeys() OVERRIDE {
+ return prereqs_;
+ }
+
+ protected:
+ std::string name_;
+ std::vector<std::string> prereqs_;
+ ParsingWatcher* watcher_;
+ };
+
+ class FailingTestManifestHandler : public TestManifestHandler {
+ public:
+ FailingTestManifestHandler(const std::string& name,
+ const std::vector<std::string> prereqs,
+ ParsingWatcher* watcher)
+ : TestManifestHandler(name, prereqs, watcher) {
+ }
+ virtual bool Parse(Extension* extension, string16* error) OVERRIDE {
+ *error = ASCIIToUTF16(name_);
+ return false;
+ }
+ };
+
+ class AlwaysParseTestManifestHandler : public TestManifestHandler {
+ public:
+ AlwaysParseTestManifestHandler(const std::string& name,
+ const std::vector<std::string> prereqs,
+ ParsingWatcher* watcher)
+ : TestManifestHandler(name, prereqs, watcher) {
+ }
+
+ virtual bool AlwaysParseForType(Manifest::Type type) OVERRIDE {
+ return true;
+ }
+ };
+
+ protected:
+ virtual void SetUp() OVERRIDE {
+ ManifestHandler::ClearRegistryForTesting();
+ }
+};
+
+TEST_F(ManifestHandlerTest, DependentHandlers) {
+ ParsingWatcher watcher;
+ std::vector<std::string> prereqs;
+ ManifestHandler::Register(
+ "a", make_linked_ptr(new TestManifestHandler("A", prereqs, &watcher)));
+ ManifestHandler::Register(
+ "b", make_linked_ptr(new TestManifestHandler("B", prereqs, &watcher)));
+ ManifestHandler::Register(
+ "j", make_linked_ptr(new TestManifestHandler("J", prereqs, &watcher)));
+ ManifestHandler::Register(
+ "k", make_linked_ptr(
+ new AlwaysParseTestManifestHandler("K", prereqs, &watcher)));
+ prereqs.push_back("c.d");
+ linked_ptr<TestManifestHandler> handler_c2(
+ new TestManifestHandler("C.EZ", prereqs, &watcher));
+ ManifestHandler::Register("c.e", handler_c2);
+ ManifestHandler::Register("c.z", handler_c2);
+ prereqs.clear();
+ prereqs.push_back("b");
+ prereqs.push_back("k");
+ ManifestHandler::Register(
+ "c.d", make_linked_ptr(new TestManifestHandler(
+ "C.D", prereqs, &watcher)));
+
+ scoped_refptr<Extension> extension = ExtensionBuilder()
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "no name")
+ .Set("version", "0")
+ .Set("manifest_version", 2)
+ .Set("a", 1)
+ .Set("b", 2)
+ .Set("c", DictionaryBuilder()
+ .Set("d", 3)
+ .Set("e", 4)
+ .Set("f", 5))
+ .Set("g", 6))
+ .Build();
+
+ // A, B, C.EZ, C.D, K
+ EXPECT_EQ(5u, watcher.parsed_names().size());
+ EXPECT_TRUE(watcher.ParsedBefore("B", "C.D"));
+ EXPECT_TRUE(watcher.ParsedBefore("K", "C.D"));
+ EXPECT_TRUE(watcher.ParsedBefore("C.D", "C.EZ"));
+}
+
+TEST_F(ManifestHandlerTest, FailingHandlers) {
+ // Can't use ExtensionBuilder, because this extension will fail to
+ // be parsed.
+ scoped_ptr<base::DictionaryValue> manifest_a(
+ DictionaryBuilder()
+ .Set("name", "no name")
+ .Set("version", "0")
+ .Set("manifest_version", 2)
+ .Set("a", 1)
+ .Build());
+
+ // Succeeds when "a" is not recognized.
+ std::string error;
+ scoped_refptr<Extension> extension = Extension::Create(
+ FilePath(),
+ Manifest::INVALID_LOCATION,
+ *manifest_a,
+ Extension::NO_FLAGS,
+ &error);
+ EXPECT_TRUE(extension);
+
+ // Register a handler for "a" that fails.
+ ParsingWatcher watcher;
+ ManifestHandler::Register(
+ "a", make_linked_ptr(new FailingTestManifestHandler(
+ "A", std::vector<std::string>(), &watcher)));
+
+ extension = Extension::Create(
+ FilePath(),
+ Manifest::INVALID_LOCATION,
+ *manifest_a,
+ Extension::NO_FLAGS,
+ &error);
+ EXPECT_FALSE(extension);
+ EXPECT_EQ("A", error);
+}
+
+} // namespace extensions
diff --git a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc
index 80f3392..2e12386 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc
@@ -11,6 +11,7 @@
#include "base/path_service.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension_l10n_util.h"
+#include "chrome/common/extensions/manifest_handler.h"
#include "ui/base/l10n/l10n_util.h"
using extensions::Extension;
@@ -20,6 +21,10 @@ ExtensionManifestTest::ExtensionManifestTest()
// UNKNOWN == trunk.
current_channel_(chrome::VersionInfo::CHANNEL_UNKNOWN) {}
+void ExtensionManifestTest::SetUp() {
+ extensions::ManifestHandler::ClearRegistryForTesting();
+}
+
// static
DictionaryValue* ExtensionManifestTest::LoadManifestFile(
const std::string& filename,
diff --git a/chrome/common/extensions/manifest_tests/extension_manifest_test.h b/chrome/common/extensions/manifest_tests/extension_manifest_test.h
index b1c330d..d803408 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifest_test.h
+++ b/chrome/common/extensions/manifest_tests/extension_manifest_test.h
@@ -13,14 +13,13 @@
#include "chrome/common/extensions/manifest.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace errors = extension_manifest_errors;
-namespace keys = extension_manifest_keys;
-
class ExtensionManifestTest : public testing::Test {
public:
ExtensionManifestTest();
protected:
+ virtual void SetUp() OVERRIDE;
+
// If filename is a relative path, LoadManifestFile will treat it relative to
// the appropriate test directory.
static DictionaryValue* LoadManifestFile(const std::string& filename,
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc
index 07551ec..d929169 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc
@@ -16,6 +16,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace errors = extension_manifest_errors;
+namespace keys = extension_manifest_keys;
namespace extensions {
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc
index afcde45..d6ebc78 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc
@@ -14,7 +14,7 @@ class DevToolsPageManifestTest : public ExtensionManifestTest {
ExtensionManifestTest::SetUp();
extensions::ManifestHandler::Register(
extension_manifest_keys::kDevToolsPage,
- new extensions::DevToolsPageHandler);
+ make_linked_ptr(new extensions::DevToolsPageHandler));
}
};
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc
index 71b2f31..e3b7bad 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc
@@ -15,10 +15,12 @@ namespace errors = extension_manifest_errors;
class HomepageURLManifestTest : public ExtensionManifestTest {
virtual void SetUp() OVERRIDE {
ExtensionManifestTest::SetUp();
- extensions::ManifestHandler::Register(extension_manifest_keys::kHomepageURL,
- new extensions::HomepageURLHandler);
- extensions::ManifestHandler::Register(extension_manifest_keys::kUpdateURL,
- new extensions::UpdateURLHandler);
+ extensions::ManifestHandler::Register(
+ extension_manifest_keys::kHomepageURL,
+ make_linked_ptr(new extensions::HomepageURLHandler));
+ extensions::ManifestHandler::Register(
+ extension_manifest_keys::kUpdateURL,
+ make_linked_ptr(new extensions::UpdateURLHandler));
}
};
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc
index aa7f5c5f..ed658be 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc
@@ -25,10 +25,10 @@ class InitValueManifestTest : public ExtensionManifestTest {
ExtensionManifestTest::SetUp();
extensions::ManifestHandler::Register(
extension_manifest_keys::kOptionsPage,
- new extensions::OptionsPageHandler);
+ make_linked_ptr(new extensions::OptionsPageHandler));
extensions::ManifestHandler::Register(
extension_manifest_keys::kDefaultLocale,
- new extensions::DefaultLocaleHandler);
+ make_linked_ptr(new extensions::DefaultLocaleHandler));
}
};
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc
index 9797b0c..4cf2475 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc
@@ -12,6 +12,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace errors = extension_manifest_errors;
+namespace keys = extension_manifest_keys;
using extensions::ErrorUtils;
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc
index 562c61c..f90d361 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc
@@ -13,8 +13,9 @@ namespace errors = extension_manifest_errors;
class OptionsPageManifestTest : public ExtensionManifestTest {
virtual void SetUp() OVERRIDE {
ExtensionManifestTest::SetUp();
- extensions::ManifestHandler::Register(extension_manifest_keys::kOptionsPage,
- new extensions::OptionsPageHandler);
+ extensions::ManifestHandler::Register(
+ extension_manifest_keys::kOptionsPage,
+ make_linked_ptr(new extensions::OptionsPageHandler));
}
};
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc
index 9e4489d..ac235c2 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc
@@ -13,8 +13,9 @@ namespace errors = extension_manifest_errors;
class URLOverridesManifestTest : public ExtensionManifestTest {
virtual void SetUp() OVERRIDE {
ExtensionManifestTest::SetUp();
- extensions::ManifestHandler::Register(keys::kChromeURLOverrides,
- new extensions::URLOverridesHandler);
+ extensions::ManifestHandler::Register(
+ extension_manifest_keys::kChromeURLOverrides,
+ make_linked_ptr(new extensions::URLOverridesHandler));
}
};
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_ui_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_ui_unittest.cc
index 800b0e8..f579b56 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_ui_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_ui_unittest.cc
@@ -15,7 +15,7 @@ class UIManifestTest : public ExtensionManifestTest {
protected:
virtual void SetUp() OVERRIDE {
ManifestHandler::Register(extension_manifest_keys::kBrowserAction,
- new BrowserActionHandler);
+ make_linked_ptr(new BrowserActionHandler));
}
};
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc
index f51a4c3..b2e5440 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc
@@ -15,8 +15,9 @@ namespace errors = extension_manifest_errors;
class UpdateURLManifestTest : public ExtensionManifestTest {
virtual void SetUp() OVERRIDE {
ExtensionManifestTest::SetUp();
- extensions::ManifestHandler::Register(extension_manifest_keys::kUpdateURL,
- new extensions::UpdateURLHandler);
+ extensions::ManifestHandler::Register(
+ extension_manifest_keys::kUpdateURL,
+ make_linked_ptr(new extensions::UpdateURLHandler));
}
};
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc
index 438c9e5..bcdb9c9 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_web_accessible_resources_unittest.cc
@@ -16,7 +16,7 @@ class WebAccessibleResourcesManifestTest : public ExtensionManifestTest {
ExtensionManifestTest::SetUp();
extensions::ManifestHandler::Register(
extension_manifest_keys::kWebAccessibleResources,
- new extensions::WebAccessibleResourcesHandler);
+ make_linked_ptr(new extensions::WebAccessibleResourcesHandler));
}
};
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_web_intents_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_web_intents_unittest.cc
index 60406f0..0c508d9 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_web_intents_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_web_intents_unittest.cc
@@ -18,8 +18,9 @@ namespace errors = extension_manifest_errors;
class WebIntentsManifestTest : public ExtensionManifestTest {
virtual void SetUp() OVERRIDE {
ExtensionManifestTest::SetUp();
- extensions::ManifestHandler::Register(extension_manifest_keys::kIntents,
- new extensions::WebIntentsHandler);
+ extensions::ManifestHandler::Register(
+ extension_manifest_keys::kIntents,
+ make_linked_ptr(new extensions::WebIntentsHandler));
}
};
diff --git a/chrome/common/extensions/unpacker_unittest.cc b/chrome/common/extensions/unpacker_unittest.cc
index a89881f..b6efe10 100644
--- a/chrome/common/extensions/unpacker_unittest.cc
+++ b/chrome/common/extensions/unpacker_unittest.cc
@@ -34,8 +34,9 @@ public:
virtual void SetUp() OVERRIDE {
testing::Test::SetUp();
- extensions::ManifestHandler::Register(keys::kDefaultLocale,
- new extensions::DefaultLocaleHandler);
+ extensions::ManifestHandler::Register(
+ keys::kDefaultLocale,
+ make_linked_ptr(new extensions::DefaultLocaleHandler));
}
void SetupUnpacker(const std::string& crx_name) {