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

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

Issue 164458: Land http://codereview.chromium.org/159067: (Closed)
Patch Set: undo docs Created 11 years, 4 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/browser/extensions/extension_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_browsertests_misc.cc
diff --git a/chrome/browser/extensions/extension_browsertests_misc.cc b/chrome/browser/extensions/extension_browsertests_misc.cc
index c3770b0b8405494fea74b067405065bf3e57e1c4..1384998f76dbec29f9825955e65bbb9927ff383c 100644
--- a/chrome/browser/extensions/extension_browsertests_misc.cc
+++ b/chrome/browser/extensions/extension_browsertests_misc.cc
@@ -48,11 +48,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, Toolstrip) {
AppendASCII("1.0.0.0");
ASSERT_TRUE(LoadExtension(extension_test_data_dir));
- // At this point, there should be two ExtensionHosts loaded because this
- // extension has two toolstrips. Find the one that is hosting toolstrip1.html.
+ // At this point, there should be three ExtensionHosts loaded because this
+ // extension has two toolstrips and one background page. Find the one that is
+ // hosting toolstrip1.html.
ExtensionProcessManager* manager =
browser()->profile()->GetExtensionProcessManager();
- ExtensionHost* host = FindHostWithPath(manager, "/toolstrip1.html", 2);
+ ExtensionHost* host = FindHostWithPath(manager, "/toolstrip1.html", 3);
// Tell it to run some JavaScript that tests that basic extension code works.
bool result = false;
@@ -77,6 +78,45 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, Toolstrip) {
#endif
}
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, ExtensionViews) {
+ FilePath extension_test_data_dir = test_data_dir_.AppendASCII("good").
+ AppendASCII("Extensions").AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj").
+ AppendASCII("1.0.0.0");
+ ASSERT_TRUE(LoadExtension(extension_test_data_dir));
+
+ // At this point, there should be three ExtensionHosts loaded because this
+ // extension has two toolstrips and one background page. Find the one that is
+ // hosting toolstrip1.html.
+ ExtensionProcessManager* manager =
+ browser()->profile()->GetExtensionProcessManager();
+ ExtensionHost* host = FindHostWithPath(manager, "/toolstrip1.html", 3);
+
+ FilePath gettabs_url = extension_test_data_dir.AppendASCII(
+ "test_gettabs.html");
+ ui_test_utils::NavigateToURL(
+ browser(),
+ GURL(gettabs_url.ToWStringHack()));
+
+ bool result = false;
+ ui_test_utils::ExecuteJavaScriptAndExtractBool(
+ host->render_view_host(), L"", L"testgetToolstripsAPI()", &result);
+ EXPECT_TRUE(result);
+
+ result = false;
+ ui_test_utils::ExecuteJavaScriptAndExtractBool(
+ host->render_view_host(), L"", L"testgetBackgroundPageAPI()", &result);
+ EXPECT_TRUE(result);
+
+ ui_test_utils::NavigateToURL(
+ browser(),
+ GURL("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/"
+ "test_gettabs.html"));
+ result = false;
+ ui_test_utils::ExecuteJavaScriptAndExtractBool(
+ host->render_view_host(), L"", L"testgetTabContentsesAPI()", &result);
+ EXPECT_TRUE(result);
+}
+
// Tests that the ExtensionShelf initializes properly, notices that
// an extension loaded and has a view available, and then sets that up
// properly.
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698