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

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

Issue 11724002: Move ContentScripts out of Extension (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_browser_action
Patch Set: Wider net for registration Created 7 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_unittest.cc
diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc
index d01a4827a4910a01165e05553c2d87cf186801bc..67213566c3b39aa811860b1b101a2a303a104ae1 100644
--- a/chrome/common/extensions/extension_unittest.cc
+++ b/chrome/common/extensions/extension_unittest.cc
@@ -14,6 +14,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/api/commands/commands_handler.h"
+#include "chrome/common/extensions/api/content_scripts/content_scripts_handler.h"
#include "chrome/common/extensions/api/extension_action/action_info.h"
#include "chrome/common/extensions/command.h"
#include "chrome/common/extensions/extension_file_util.h"
@@ -124,6 +125,9 @@ static void LoadActionAndExpectError(const std::string& manifest,
class ExtensionTest : public testing::Test {
protected:
virtual void SetUp() OVERRIDE {
+ testing::Test::SetUp();
+ ManifestHandler::Register(extension_manifest_keys::kContentScripts,
+ new ContentScriptsHandler);
ManifestHandler::Register(extension_manifest_keys::kCommands,
new CommandsHandler);
}
@@ -706,34 +710,58 @@ TEST_F(ExtensionTest, WantsFileAccess) {
extension = LoadManifest("permissions", "content_script_all_urls.json");
EXPECT_TRUE(extension->wants_file_access());
EXPECT_FALSE(extension->CanExecuteScriptOnPage(
- file_url, file_url, -1, &extension->content_scripts()[0], NULL));
+ file_url,
+ file_url,
+ -1,
+ &ContentScriptsInfo::GetContentScripts(extension)[0],
+ NULL));
extension = LoadManifest("permissions", "content_script_all_urls.json",
Extension::ALLOW_FILE_ACCESS);
EXPECT_TRUE(extension->wants_file_access());
EXPECT_TRUE(extension->CanExecuteScriptOnPage(
- file_url, file_url, -1, &extension->content_scripts()[0], NULL));
+ file_url,
+ file_url,
+ -1,
+ &ContentScriptsInfo::GetContentScripts(extension)[0],
+ NULL));
// file:///* content script match
extension = LoadManifest("permissions", "content_script_file_scheme.json");
EXPECT_TRUE(extension->wants_file_access());
EXPECT_FALSE(extension->CanExecuteScriptOnPage(
- file_url, file_url, -1, &extension->content_scripts()[0], NULL));
+ file_url,
+ file_url,
+ -1,
+ &ContentScriptsInfo::GetContentScripts(extension)[0],
+ NULL));
extension = LoadManifest("permissions", "content_script_file_scheme.json",
Extension::ALLOW_FILE_ACCESS);
EXPECT_TRUE(extension->wants_file_access());
EXPECT_TRUE(extension->CanExecuteScriptOnPage(
- file_url, file_url, -1, &extension->content_scripts()[0], NULL));
+ file_url,
+ file_url,
+ -1,
+ &ContentScriptsInfo::GetContentScripts(extension)[0],
+ NULL));
// http://* content script match
extension = LoadManifest("permissions", "content_script_http_scheme.json");
EXPECT_FALSE(extension->wants_file_access());
EXPECT_FALSE(extension->CanExecuteScriptOnPage(
- file_url, file_url, -1, &extension->content_scripts()[0], NULL));
+ file_url,
+ file_url,
+ -1,
+ &ContentScriptsInfo::GetContentScripts(extension)[0],
+ NULL));
extension = LoadManifest("permissions", "content_script_http_scheme.json",
Extension::ALLOW_FILE_ACCESS);
EXPECT_FALSE(extension->wants_file_access());
EXPECT_FALSE(extension->CanExecuteScriptOnPage(
- file_url, file_url, -1, &extension->content_scripts()[0], NULL));
+ file_url,
+ file_url,
+ -1,
+ &ContentScriptsInfo::GetContentScripts(extension)[0],
+ NULL));
}
TEST_F(ExtensionTest, ExtraFlags) {

Powered by Google App Engine
This is Rietveld 408576698