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

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

Issue 1880933002: Begin to enable extension APIs in Extension Service Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott Created 4 years, 7 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 | « chrome/browser/extensions/chrome_extension_function.cc ('k') | chrome/common/chrome_content_client.h » ('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 0110014783c050aafa00603de7c472dd5ad53b7c..68c6e0a9789a47525be737054d08d074f4a80182 100644
--- a/chrome/browser/extensions/service_worker_apitest.cc
+++ b/chrome/browser/extensions/service_worker_apitest.cc
@@ -593,6 +593,29 @@ IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, WebAccessibleResourcesFetch) {
"service_worker/web_accessible_resources/fetch/", "page.html"));
}
+IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, TabsCreate) {
+ // 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/tabs_create"), kFlagNone);
+ ASSERT_TRUE(extension);
+ ui_test_utils::NavigateToURL(browser(),
+ extension->GetResourceURL("page.html"));
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+
+ int starting_tab_count = browser()->tab_strip_model()->count();
+ std::string result;
+ ASSERT_TRUE(content::ExecuteScriptAndExtractString(
+ web_contents, "window.runServiceWorker()", &result));
+ ASSERT_EQ("chrome.tabs.create callback", result);
+ EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count());
+
+ // Check extension shutdown path.
+ UnloadExtension(extension->id());
+ EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count());
+}
+
// This test loads a web page that has an iframe pointing to a
// chrome-extension:// URL. The URL is listed in the extension's
// web_accessible_resources. Initially the iframe is served from the extension's
« no previous file with comments | « chrome/browser/extensions/chrome_extension_function.cc ('k') | chrome/common/chrome_content_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698