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..be445abd25cd93b778d3990b9bf210015a203ee5 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,33 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Foo) { |
| EXPECT_EQ(url, second_web_contents->GetVisibleURL()); |
| } |
| +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); |
| +} |
|
Łukasz Anforowicz
2017/02/09 16:53:01
1. I am not sure if this is the right location for
alexmos
2017/02/09 22:58:36
This seems like a reasonable place for it. Anothe
|
| + |
| } // namespace extensions |