| Index: chrome/browser/extensions/app_process_apitest.cc
|
| ===================================================================
|
| --- chrome/browser/extensions/app_process_apitest.cc (revision 56849)
|
| +++ chrome/browser/extensions/app_process_apitest.cc (working copy)
|
| @@ -4,7 +4,6 @@
|
|
|
| #include "base/utf_string_conversions.h"
|
| #include "chrome/browser/browser.h"
|
| -#include "chrome/browser/browser_list.h"
|
| #include "chrome/browser/extensions/extension_apitest.h"
|
| #include "chrome/browser/extensions/extension_host.h"
|
| #include "chrome/browser/extensions/extension_process_manager.h"
|
| @@ -20,9 +19,7 @@
|
|
|
| // Simulates a page calling window.open on an URL, and waits for the navigation.
|
| static void WindowOpenHelper(Browser* browser,
|
| - RenderViewHost* opener_host,
|
| - const GURL& url,
|
| - bool newtab_process_should_equal_opener) {
|
| + RenderViewHost* opener_host, const GURL& url) {
|
| bool result = false;
|
| ui_test_utils::ExecuteJavaScriptAndExtractBool(
|
| opener_host, L"",
|
| @@ -31,21 +28,12 @@
|
| &result);
|
| ASSERT_TRUE(result);
|
|
|
| - // The above window.open call is not user-initiated, it will create
|
| - // a popup window instead of a new tab in current window.
|
| - // Now the active tab in last active window should be the new tab.
|
| - Browser* last_active_browser = BrowserList::GetLastActive();
|
| - EXPECT_TRUE(last_active_browser);
|
| - TabContents* newtab = last_active_browser->GetSelectedTabContents();
|
| - EXPECT_TRUE(newtab);
|
| + // Now the current tab should be the new tab.
|
| + TabContents* newtab = browser->GetSelectedTabContents();
|
| if (!newtab->controller().GetLastCommittedEntry() ||
|
| newtab->controller().GetLastCommittedEntry()->url() != url)
|
| ui_test_utils::WaitForNavigation(&newtab->controller());
|
| EXPECT_EQ(url, newtab->controller().GetLastCommittedEntry()->url());
|
| - if (newtab_process_should_equal_opener)
|
| - EXPECT_EQ(opener_host->process(), newtab->render_view_host()->process());
|
| - else
|
| - EXPECT_NE(opener_host->process(), newtab->render_view_host()->process());
|
| }
|
|
|
| // Simulates a page navigating itself to an URL, and waits for the navigation.
|
| @@ -67,9 +55,6 @@
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) {
|
| - CommandLine::ForCurrentProcess()->AppendSwitch(
|
| - switches::kDisablePopupBlocking);
|
| -
|
| host_resolver()->AddRule("*", "127.0.0.1");
|
| ASSERT_TRUE(test_server()->Start());
|
|
|
| @@ -97,14 +82,21 @@
|
| browser()->GetTabContentsAt(3)->render_view_host()->process());
|
|
|
| // Now let's do the same using window.open. The same should happen.
|
| - ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile()));
|
| WindowOpenHelper(browser(), host,
|
| - base_url.Resolve("path1/empty.html"), true);
|
| + base_url.Resolve("path1/empty.html"));
|
| WindowOpenHelper(browser(), host,
|
| - base_url.Resolve("path2/empty.html"), true);
|
| + base_url.Resolve("path2/empty.html"));
|
| WindowOpenHelper(browser(), host,
|
| - base_url.Resolve("path3/empty.html"), false);
|
| + base_url.Resolve("path3/empty.html"));
|
|
|
| + ASSERT_EQ(7, browser()->tab_count());
|
| + EXPECT_EQ(host->process(),
|
| + browser()->GetTabContentsAt(4)->render_view_host()->process());
|
| + EXPECT_EQ(host->process(),
|
| + browser()->GetTabContentsAt(5)->render_view_host()->process());
|
| + EXPECT_NE(host->process(),
|
| + browser()->GetTabContentsAt(6)->render_view_host()->process());
|
| +
|
| // Now let's have these pages navigate, into or out of the extension web
|
| // extent. They should switch processes.
|
| const GURL& app_url(base_url.Resolve("path1/empty.html"));
|
|
|