Chromium Code Reviews| 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 5df6a2a4c3b67e3c163fe0b41fa560a98ec4148d..c7baee64ef33a62a6b2e2e43f3961b019ac80342 100644 | 
| --- a/chrome/browser/extensions/api/tabs/tabs_test.cc | 
| +++ b/chrome/browser/extensions/api/tabs/tabs_test.cc | 
| @@ -39,6 +39,7 @@ | 
| #include "components/prefs/pref_service.h" | 
| #include "content/public/browser/browser_context.h" | 
| #include "content/public/browser/notification_service.h" | 
| +#include "content/public/browser/render_frame_host.h" | 
| #include "content/public/browser/storage_partition.h" | 
| #include "content/public/common/page_zoom.h" | 
| #include "content/public/common/url_constants.h" | 
| @@ -2108,7 +2109,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsZoomTest, CannotZoomInvalidTab) { | 
| } | 
| // Regression test for crbug.com/660498. | 
| -IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Foo) { | 
| +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, TemporaryAddressSpoof) { | 
| ASSERT_TRUE(StartEmbeddedTestServer()); | 
| content::WebContents* first_web_contents = | 
| browser()->tab_strip_model()->GetActiveWebContents(); | 
| @@ -2136,4 +2137,36 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Foo) { | 
| EXPECT_EQ(url, second_web_contents->GetVisibleURL()); | 
| } | 
| +// Window created by chrome.windows.create should be in the same site instance | 
| 
 
alexmos
2017/02/09 22:58:36
nit: s/site instance/SiteInstance/
 
Łukasz Anforowicz
2017/02/10 00:38:18
Done.
 
 | 
| +// as the opener - regression test for hangouts-vs-isolate-extensions-trouble | 
| +// (see also https://crbug.com/597750). | 
| +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WindowCreateVsSiteInstance) { | 
| + const extensions::Extension* extension = | 
| + LoadExtension(test_data_dir_.AppendASCII("../simple_with_file")); | 
| + ASSERT_TRUE(extension); | 
| + | 
| + GURL extension_url = extension->GetResourceURL("file.html"); | 
| + ui_test_utils::NavigateToURL(browser(), extension_url); | 
| + content::WebContents* old_contents = | 
| + browser()->tab_strip_model()->GetActiveWebContents(); | 
| + | 
| + content::WebContentsAddedObserver observer; | 
| + ASSERT_TRUE(content::ExecuteScript( | 
| + old_contents, | 
| + "window.name = 'test-name';\n" | 
| + "chrome.windows.create({url: '" + extension_url.spec() + "'})")); | 
| + content::WebContents* new_contents = observer.GetWebContents(); | 
| + | 
| + EXPECT_EQ(old_contents->GetMainFrame()->GetSiteInstance(), | 
| + new_contents->GetMainFrame()->GetSiteInstance()); | 
| + | 
| + std::string url_of_found_window; | 
| + ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 
| + old_contents, | 
| + "w = window.open('', 'test-name');\n" | 
| + "window.domAutomationController.send(w.location.href)", | 
| + &url_of_found_window)); | 
| + EXPECT_EQ(extension_url.spec(), url_of_found_window); | 
| 
 
alexmos
2017/02/09 22:58:36
I'm a bit confused here: is this testing that old_
 
Łukasz Anforowicz
2017/02/10 00:38:18
Doh... thanks for catching this.  I meant to execu
 
 | 
| +} | 
| + | 
| } // namespace extensions |