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

Unified Diff: chrome/browser/extensions/content_script_apitest.cc

Issue 8585005: Enable content scripts to receive extension API events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 1 month 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 | « no previous file | chrome/browser/extensions/extension_event_router.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/content_script_apitest.cc
diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc
index 69110c7eb02b30cc9c10fe67308e1b1dcfca0d0c..0aaaf752f11ae6561b7db649ea1dd9f96ccd51f7 100644
--- a/chrome/browser/extensions/content_script_apitest.cc
+++ b/chrome/browser/extensions/content_script_apitest.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -114,9 +115,26 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptCSSLocalization) {
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionAPIs) {
ASSERT_TRUE(StartTestServer());
- LoadExtension(test_data_dir_.AppendASCII("content_scripts/extension_api"));
+
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableExperimentalExtensionApis);
+ const Extension* extension = LoadExtension(
+ test_data_dir_.AppendASCII("content_scripts/extension_api"));
+
ResultCatcher catcher;
ui_test_utils::NavigateToURL(
browser(), test_server()->GetURL("functions.html"));
EXPECT_TRUE(catcher.GetNextResult());
+
+ // Navigate to a page that will cause a content script to run that starts
+ // listening for an extension event.
+ ui_test_utils::NavigateToURL(
+ browser(), test_server()->GetURL("events.html"));
+
+ // Navigate to an extension page that will fire the event events.js is
+ // listening for.
+ ui_test_utils::NavigateToURLWithDisposition(
+ browser(), extension->GetResourceURL("fire_event.html"),
+ NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_NONE);
+ EXPECT_TRUE(catcher.GetNextResult());
}
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698