diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 21:42:33 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 21:42:33 +0000 |
commit | 015ed8bbc256a94f03dacf13e93c05e4eff25dcd (patch) | |
tree | 479976899d3e957a77da598bb05ee145876219be | |
parent | 71d1ab42f849b22bc26bcf2756d5d664a5454884 (diff) | |
download | chromium_src-015ed8bbc256a94f03dacf13e93c05e4eff25dcd.zip chromium_src-015ed8bbc256a94f03dacf13e93c05e4eff25dcd.tar.gz chromium_src-015ed8bbc256a94f03dacf13e93c05e4eff25dcd.tar.bz2 |
ifdef out tests that don't apply to the Mac
The reason these tests were failing on the Mac is that they test something that the Mac explicitly doesn't support: opening a new window in the existing browser process by re-running from the command line. This ifdefs out the tests that don't apply to the Mac, and the helper method that they are built on so that new tests using it won't accidentally be run on the Mac.
BUG=45108
TEST=N/A
Review URL: http://codereview.chromium.org/3394018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60354 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/chrome_main_uitest.cc | 15 | ||||
-rw-r--r-- | chrome/browser/sessions/session_restore_uitest.cc | 69 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.cc | 2 | ||||
-rw-r--r-- | chrome/test/ui/ui_test.h | 7 |
4 files changed, 48 insertions, 45 deletions
diff --git a/chrome/app/chrome_main_uitest.cc b/chrome/app/chrome_main_uitest.cc index 851a592..65df2c2 100644 --- a/chrome/app/chrome_main_uitest.cc +++ b/chrome/app/chrome_main_uitest.cc @@ -39,10 +39,10 @@ TEST_F(ChromeMainTest, AppTestingInterface) { EXPECT_EQ(1, GetTabCount()); } -#if defined(OS_MACOSX) -// Fails an SQL assertion on Mac: http://crbug.com/45108 -#define SecondLaunch DISABLED_SecondLaunch -#endif +#if !defined(OS_MACOSX) +// These tests don't apply to the Mac version; see +// LaunchAnotherBrowserBlockUntilClosed for details. + // Make sure that the second invocation creates a new window. TEST_F(ChromeMainTest, SecondLaunch) { include_testing_id_ = false; @@ -53,11 +53,6 @@ TEST_F(ChromeMainTest, SecondLaunch) { ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); } -#if defined(OS_MACOSX) -// Fails an SQL assertion on Mac: http://crbug.com/45108 -#define ReuseBrowserInstanceWhenOpeningFile \ - DISABLED_ReuseBrowserInstanceWhenOpeningFile -#endif TEST_F(ChromeMainTest, ReuseBrowserInstanceWhenOpeningFile) { include_testing_id_ = false; @@ -69,3 +64,5 @@ TEST_F(ChromeMainTest, ReuseBrowserInstanceWhenOpeningFile) { ASSERT_TRUE(automation()->IsURLDisplayed(net::FilePathToFileURL(test_file))); } + +#endif // !OS_MACOSX diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc index df29c13..949bdf4 100644 --- a/chrome/browser/sessions/session_restore_uitest.cc +++ b/chrome/browser/sessions/session_restore_uitest.cc @@ -327,10 +327,10 @@ TEST_F(SessionRestoreUITest, NormalAndPopup) { } } -#if defined(OS_MACOSX) -// Fails an SQL assertion on Mac: http://crbug.com/45108 -#define DontRestoreWhileIncognito DISABLED_DontRestoreWhileIncognito -#endif +#if !defined(OS_MACOSX) +// These tests don't apply to the Mac version; see +// LaunchAnotherBrowserBlockUntilClosed for details. + // Creates a browser, goes incognito, closes browser, launches and make sure // we don't restore. // @@ -376,38 +376,6 @@ TEST_F(SessionRestoreUITest, DontRestoreWhileIncognito) { ASSERT_TRUE(url != url1_); } -// Creates two windows, closes one, restores, make sure only one window open. -TEST_F(SessionRestoreUITest, TwoWindowsCloseOneRestoreOnlyOne) { - NavigateToURL(url1_); - - // Make sure we have one window. - int window_count; - ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); - ASSERT_EQ(1, window_count); - - // Open a second window. - ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, - true)); - ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); - ASSERT_EQ(2, window_count); - - // Close it. - CloseWindow(1, 2); - - // Restart and make sure we have only one window with one tab and the url - // is url1_. - QuitBrowserAndRestore(1); - - AssertOneWindowWithOneTab(); - - ASSERT_EQ(url1_, GetActiveTabURL()); -} - -#if defined(OS_MACOSX) -// Fails an SQL assertion on Mac: http://crbug.com/45108 -#define FLAKY_RestoreAfterClosingTabbedBrowserWithAppAndLaunching \ - DISABLED_RestoreAfterClosingTabbedBrowserWithAppAndLaunching -#endif // Launches an app window, closes tabbed browser, launches and makes sure // we restore the tabbed browser url. TEST_F(SessionRestoreUITest, @@ -438,6 +406,35 @@ TEST_F(SessionRestoreUITest, ASSERT_EQ(url1_, GetActiveTabURL()); } +#endif // !OS_MACOSX + +// Creates two windows, closes one, restores, make sure only one window open. +TEST_F(SessionRestoreUITest, TwoWindowsCloseOneRestoreOnlyOne) { + NavigateToURL(url1_); + + // Make sure we have one window. + int window_count; + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); + ASSERT_EQ(1, window_count); + + // Open a second window. + ASSERT_TRUE(automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, + true)); + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); + ASSERT_EQ(2, window_count); + + // Close it. + CloseWindow(1, 2); + + // Restart and make sure we have only one window with one tab and the url + // is url1_. + QuitBrowserAndRestore(1); + + AssertOneWindowWithOneTab(); + + ASSERT_EQ(url1_, GetActiveTabURL()); +} + #if defined(OS_LINUX) || defined(OS_MACOSX) // Flaky, sometimes times out: http://crbug.com/52022 #define MAYBE_ShareProcessesOnRestore FLAKY_ShareProcessesOnRestore diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index 9b0fd69..7a3b9c5 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -319,10 +319,12 @@ void UITestBase::LaunchBrowser(const CommandLine& arguments, process_id_ = base::GetProcId(process_); } +#if !defined(OS_MACOSX) bool UITestBase::LaunchAnotherBrowserBlockUntilClosed( const CommandLine& cmdline) { return LaunchBrowserHelper(cmdline, true, NULL); } +#endif void UITestBase::QuitBrowser() { if (SESSION_ENDING == shutdown_type_) { diff --git a/chrome/test/ui/ui_test.h b/chrome/test/ui/ui_test.h index 7df0a8c..b2a11e6 100644 --- a/chrome/test/ui/ui_test.h +++ b/chrome/test/ui/ui_test.h @@ -85,9 +85,16 @@ class UITestBase { // LaunchAnotherBrowserBlockUntilClosed. void LaunchBrowser(const CommandLine& cmdline, bool clear_profile); +#if !defined(OS_MACOSX) + // This function is deliberately not defined on the Mac because re-using an + // existing browser process when launching from the command line isn't a + // concept that we support on the Mac; AppleEvents are the Mac solution for + // the same need. Any test based on this function doesn't apply to the Mac. + // Launches an another browser process and waits for it to finish. Returns // true on success. bool LaunchAnotherBrowserBlockUntilClosed(const CommandLine& cmdline); +#endif // Exits out browser instance. void QuitBrowser(); |