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

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

Issue 2886923002: [extension SW]: Support event listener registration and event dispatching. (Closed)
Patch Set: sync Created 3 years, 6 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 | « no previous file | chrome/common/extensions/api/_api_features.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/service_worker_apitest.cc
diff --git a/chrome/browser/extensions/service_worker_apitest.cc b/chrome/browser/extensions/service_worker_apitest.cc
index e432163b3b4e156ba8c5f9984cf29367c3b77663..54dc7462cf1f94b9dd4d7bf0aad1ec034f52eea8 100644
--- a/chrome/browser/extensions/service_worker_apitest.cc
+++ b/chrome/browser/extensions/service_worker_apitest.cc
@@ -666,6 +666,22 @@ IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, TabsCreate) {
EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count());
}
+IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, Events) {
+ // Extensions APIs from SW are only enabled on trunk.
+ ScopedCurrentChannel current_channel_override(version_info::Channel::UNKNOWN);
+ const Extension* extension = LoadExtensionWithFlags(
+ test_data_dir_.AppendASCII("service_worker/events"), kFlagNone);
+ ASSERT_TRUE(extension);
+ ui_test_utils::NavigateToURL(browser(),
+ extension->GetResourceURL("page.html"));
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ std::string result;
+ ASSERT_TRUE(content::ExecuteScriptAndExtractString(
+ web_contents, "window.runEventTest()", &result));
+ ASSERT_EQ("chrome.tabs.onUpdated callback", result);
+}
+
// Tests that worker ref count increments while extension API function is
// active.
« no previous file with comments | « no previous file | chrome/common/extensions/api/_api_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698