diff options
author | skerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-01 15:32:19 +0000 |
---|---|---|
committer | skerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-01 15:32:19 +0000 |
commit | a5d24d34fa7917464367bcf216ec3c8f8dedfb97 (patch) | |
tree | 84fcbff1367262bd4a1ede2867fcedd5605b7061 /chrome/browser/browser_browsertest.cc | |
parent | 0f174b380ed39022676a0038303cf8dd92668f71 (diff) | |
download | chromium_src-a5d24d34fa7917464367bcf216ec3c8f8dedfb97.zip chromium_src-a5d24d34fa7917464367bcf216ec3c8f8dedfb97.tar.gz chromium_src-a5d24d34fa7917464367bcf216ec3c8f8dedfb97.tar.bz2 |
Revert 51362 - Un-flake and enable test.
Ran tests for a few hours on windows without seeing a failure.
BUG=44026
TEST=BrowserAppRefocusTest.*
Review URL: http://codereview.chromium.org/2870036
TBR=skerner@chromium.org
Review URL: http://codereview.chromium.org/2865031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51365 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_browsertest.cc')
-rw-r--r-- | chrome/browser/browser_browsertest.cc | 55 |
1 files changed, 18 insertions, 37 deletions
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc index b80ba65..a4bfaf9 100644 --- a/chrome/browser/browser_browsertest.cc +++ b/chrome/browser/browser_browsertest.cc @@ -5,7 +5,6 @@ #include <string> #include "app/l10n_util.h" -#include "base/compiler_specific.h" #include "base/i18n/rtl.h" #include "base/file_path.h" #include "base/sys_info.h" @@ -638,11 +637,10 @@ class BrowserAppRefocusTest : public ExtensionBrowserTest { // because starting the http server crashes if called from that function. // The IO thread is not set up at that point. virtual void SetUpExtensionApp() { - // The web URL of the example app we load has a host of - // www.example.com . server_ = StartHTTPServer(); ASSERT_TRUE(server_); host_resolver()->AddRule("www.example.com", "127.0.0.1"); + url_ = GURL(server_->TestServerPage("empty.html")); profile_ = browser()->profile(); ASSERT_TRUE(profile_); @@ -660,29 +658,14 @@ class BrowserAppRefocusTest : public ExtensionBrowserTest { ASSERT_TRUE(extension_app_) << "App Test extension not loaded."; } - // Given a tab, wait for navigation in the tab, then test that it is - // selected. If this function returns false, an error was logged. - bool WaitForTab(TabContents* tab) WARN_UNUSED_RESULT { - if (!tab) { - LOG(ERROR) << "|tab| should not be NULL."; - return false; - } - ui_test_utils::WaitForNavigation(&(tab->controller())); - if (tab != browser()->GetSelectedTabContents()) { - LOG(ERROR) << "Tab was not selected."; - return false; - } - return true; - } - HTTPTestServer* server_; Extension* extension_app_; Profile* profile_; + GURL url_; }; #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)) -#define MAYBE_OpenTab OpenTab #define MAYBE_OpenPanel OpenPanel #define MAYBE_OpenWindow OpenWindow #define MAYBE_WindowBeforeTab WindowBeforeTab @@ -693,9 +676,8 @@ class BrowserAppRefocusTest : public ExtensionBrowserTest { // Crashes on mac involving app panels: http://crbug.com/42865 -// Tests fail on Chrome OS: http://crbug.com/43061 - -#define MAYBE_OpenTab DISABLED_OpenTab +// ChromeOS doesn't open extension based app windows correctly yet: +// http://crbug.com/43061 #define MAYBE_OpenPanel DISABLED_OpenPanel #define MAYBE_OpenWindow DISABLED_OpenWindow #define MAYBE_WindowBeforeTab DISABLED_WindowBeforeTab @@ -705,28 +687,26 @@ class BrowserAppRefocusTest : public ExtensionBrowserTest { #endif // Test that launching an app refocuses a tab already hosting the app. -IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_OpenTab) { +// Hangs flakily, http://crbug.com/44026. +IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, DISABLED_OpenTab) { SetUpExtensionApp(); + ui_test_utils::NavigateToURL(browser(), url_); ASSERT_EQ(1, browser()->tab_count()); ASSERT_EQ(NULL, Browser::FindAppTab(browser(), extension_app_)); // Open a tab with the app. - TabContents* tab = Browser::OpenApplicationTab(profile_, extension_app_); - ASSERT_TRUE(WaitForTab(tab)); + Browser::OpenApplicationTab(profile_, extension_app_); + ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); ASSERT_EQ(2, browser()->tab_count()); - int app_tab_index = browser()->selected_index(); ASSERT_EQ(0, app_tab_index) << "App tab should be the left most tab."; ASSERT_EQ(browser()->GetTabContentsAt(0), Browser::FindAppTab(browser(), extension_app_)); // Open the same app. The existing tab should stay focused. - tab = Browser::OpenApplication(profile_, extension_app_->id()); - - // No need to wait for navigation, because the tab already exists, - // and no navigation should take place. - ASSERT_TRUE(tab != NULL); + Browser::OpenApplication(profile_, extension_app_->id()); + ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); ASSERT_EQ(2, browser()->tab_count()); ASSERT_EQ(app_tab_index, browser()->selected_index()); @@ -734,10 +714,6 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_OpenTab) { // be refocused. browser()->SelectTabContentsAt(1, false); Browser::OpenApplication(profile_, extension_app_->id()); - - tab = Browser::OpenApplication(profile_, extension_app_->id()); - ASSERT_TRUE(WaitForTab(tab)); - ASSERT_EQ(2, browser()->tab_count()); ASSERT_EQ(app_tab_index, browser()->selected_index()); @@ -764,6 +740,7 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_OpenTab) { IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_OpenPanel) { SetUpExtensionApp(); + ui_test_utils::NavigateToURL(browser(), url_); ASSERT_EQ(1, browser()->tab_count()); ASSERT_EQ(NULL, Browser::FindAppWindowOrPanel(profile_, extension_app_)); @@ -797,6 +774,7 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_OpenPanel) { IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_OpenWindow) { SetUpExtensionApp(); + ui_test_utils::NavigateToURL(browser(), url_); ASSERT_EQ(1, browser()->tab_count()); ASSERT_EQ(NULL, Browser::FindAppWindowOrPanel(profile_, extension_app_)); @@ -827,6 +805,7 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_OpenWindow) { IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_WindowBeforeTab) { SetUpExtensionApp(); + ui_test_utils::NavigateToURL(browser(), url_); ASSERT_EQ(1, browser()->tab_count()); // Open a tab with the app. @@ -856,11 +835,12 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_WindowBeforeTab) { IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_PanelBeforeTab) { SetUpExtensionApp(); + ui_test_utils::NavigateToURL(browser(), url_); ASSERT_EQ(1, browser()->tab_count()); // Open a tab with the app. - TabContents* tab = Browser::OpenApplicationTab(profile_, extension_app_); - ASSERT_TRUE(WaitForTab(tab)); + Browser::OpenApplicationTab(profile_, extension_app_); + ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); ASSERT_EQ(2, browser()->tab_count()); int app_tab_index = browser()->selected_index(); ASSERT_EQ(0, app_tab_index) << "App tab should be the left most tab."; @@ -885,6 +865,7 @@ IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_PanelBeforeTab) { IN_PROC_BROWSER_TEST_F(BrowserAppRefocusTest, MAYBE_TabInFocusedWindow) { SetUpExtensionApp(); + ui_test_utils::NavigateToURL(browser(), url_); ASSERT_EQ(1, browser()->tab_count()); Browser::OpenApplicationTab(profile_, extension_app_); |