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

Unified Diff: chrome/browser/extensions/api/tabs/tabs_test.cc

Issue 2871063002: [relanding] Adding BrowsingInstance verification to test of chrome.windows.create API. (Closed)
Patch Set: Wait for |new_contents| to stop loading before next test steps. Created 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/tabs/tabs_test.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc
index e8e64fab3e5847b655fc39b38f5d82c4957192f9..77edc9141e5f55cbc70c0acdf791f30346c8ac9f 100644
--- a/chrome/browser/extensions/api/tabs/tabs_test.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_test.cc
@@ -2164,10 +2164,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowsCreateVsSiteInstance) {
{
content::WebContentsAddedObserver observer;
ASSERT_TRUE(content::ExecuteScript(old_contents,
- "window.name = 'test-name';\n"
+ "window.name = 'old-contents';\n"
"chrome.windows.create({url: '" +
extension_url.spec() + "'})"));
new_contents = observer.GetWebContents();
+ ASSERT_TRUE(content::WaitForLoadStop(new_contents));
}
// Verify that the old and new tab are in the same process and SiteInstance.
@@ -2184,6 +2185,16 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowsCreateVsSiteInstance) {
new_contents, "window.domAutomationController.send(!!window.opener)",
&window_opener_cast_to_bool));
EXPECT_FALSE(window_opener_cast_to_bool);
+
+ // Verify that |new_contents| can find |old_contents| using window.open/name.
+ std::string location_of_other_window;
+ EXPECT_TRUE(ExecuteScriptAndExtractString(
+ new_contents,
+ "var w = window.open('', 'old-contents');\n"
+ "window.domAutomationController.send(w.location.href);",
+ &location_of_other_window));
+ EXPECT_EQ(old_contents->GetMainFrame()->GetLastCommittedURL().spec(),
+ location_of_other_window);
}
} // namespace extensions
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698