diff options
author | jnd@google.com <jnd@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-20 11:58:08 +0000 |
---|---|---|
committer | jnd@google.com <jnd@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-20 11:58:08 +0000 |
commit | 81454fa4add65101f232c18ba42838be9fe2c608 (patch) | |
tree | 9dde0ffbe0d38dc37833fbfda8b4b0dd3d8ec49b /chrome/browser/extensions | |
parent | 08fbc859c68ec143de89ae679ee03881ee22a94c (diff) | |
download | chromium_src-81454fa4add65101f232c18ba42838be9fe2c608.zip chromium_src-81454fa4add65101f232c18ba42838be9fe2c608.tar.gz chromium_src-81454fa4add65101f232c18ba42838be9fe2c608.tar.bz2 |
Revert 56834 - Fix a few test failures when landing http://trac.webkit.org/changeset/57178.
http://trac.webkit.org/changeset/57178 broke some tests in browser_test and ui_test.
In the test RedirectTest.ClientCancelled, it needs a user-initiated event to trigger the redirect, now it uses "javaScript:click()". When landing r57178, the call of window.open which is inside the call of javaScript:click() was treated as non user-initiated, so the in-page location change was treated as client redirect and the redirect was recoreded, that is why this test was failed when landing r57178. (Please refer to the logic in FrameLoaderClientImpl::dispatchDidNavigateWithinPage.)
In the tests AppApiTest.AppProcess, ExtensionBrowserTest.WindowOpenExtension and ExtensionBrowserTest.WindowOpenInvalidExtension, they assume the new tabs opened by window.open in current window. But when landing r57178, since those calls of window.open were treated as non user-initiated, the disposition type of new tabs were changed to Popup, which caused a few new tabs were created instead of a few new tabs in current window (Please refer to RenderView::show), which cause those tests were failed when landing r57178.), that is why those tests were failed when landing r57178.
BUG=17655
TEST=RedirectTest.ClientCancelled, AppApiTest.AppProcess, ExtensionBrowserTest.WindowOpenExtension, ExtensionBrowserTest.WindowOpenInvalidExtension
Review URL: http://codereview.chromium.org/3136019
TBR=jnd@google.com
Review URL: http://codereview.chromium.org/3174023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56850 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r-- | chrome/browser/extensions/app_process_apitest.cc | 36 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_browsertests_misc.cc | 7 |
2 files changed, 16 insertions, 27 deletions
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index 2062b10..4a0014b 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -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 @@ class AppApiTest : public ExtensionApiTest { // 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 @@ static void WindowOpenHelper(Browser* browser, &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 @@ static void NavigateTabHelper(TabContents* contents, const GURL& url) { } 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,13 +82,20 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { 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. diff --git a/chrome/browser/extensions/extension_browsertests_misc.cc b/chrome/browser/extensions/extension_browsertests_misc.cc index 9076447..4ede48d 100644 --- a/chrome/browser/extensions/extension_browsertests_misc.cc +++ b/chrome/browser/extensions/extension_browsertests_misc.cc @@ -614,11 +614,8 @@ static TabContents* WindowOpenHelper(Browser* browser, const GURL& start_url, L"window.domAutomationController.send(true);", &result); EXPECT_TRUE(result); - // 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(); GURL expected_url = start_url.Resolve(newtab_url); if (!newtab->controller().GetLastCommittedEntry() || newtab->controller().GetLastCommittedEntry()->url() != expected_url) |