diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 15:31:13 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 15:31:13 +0000 |
commit | d05cd10167055b92abefae9dbb700b49da657491 (patch) | |
tree | 1efbf0699b42d1d22158e418d68f2c135261d0ea /chrome/browser/sessions/session_restore_uitest.cc | |
parent | ef321762d036191157a3d31a6eff2884f3ff0356 (diff) | |
download | chromium_src-d05cd10167055b92abefae9dbb700b49da657491.zip chromium_src-d05cd10167055b92abefae9dbb700b49da657491.tar.gz chromium_src-d05cd10167055b92abefae9dbb700b49da657491.tar.bz2 |
Makes session restore on Chrome OS restore popups.
BUG=18862
TEST=none
Review URL: http://codereview.chromium.org/337030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sessions/session_restore_uitest.cc')
-rw-r--r-- | chrome/browser/sessions/session_restore_uitest.cc | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc index 5c8157b..fd25362 100644 --- a/chrome/browser/sessions/session_restore_uitest.cc +++ b/chrome/browser/sessions/session_restore_uitest.cc @@ -7,6 +7,7 @@ #include "base/scoped_ptr.h" #include "base/string_util.h" #include "chrome/app/chrome_dll_resource.h" +#include "chrome/browser/defaults.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/automation/tab_proxy.h" @@ -253,6 +254,54 @@ TEST_F(SessionRestoreUITest, ClosedTabStaysClosed) { ASSERT_TRUE(GetActiveTabURL() == url1_); } +// Creates a tabbed browser and popup and makes sure we restore both. +TEST_F(SessionRestoreUITest, NormalAndPopup) { + if (!browser_defaults::kRestorePopups) + return; // Test only applicable if restoring popups. + + NavigateToURL(url1_); + + // Make sure we have one window. + int window_count; + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); + ASSERT_EQ(1, window_count); + + // Open a popup. + ASSERT_TRUE(automation()->OpenNewBrowserWindow(BrowserProxy::TYPE_POPUP, + true)); + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); + ASSERT_EQ(2, window_count); + + // Restart and make sure we have only one window with one tab and the url + // is url1_. + QuitBrowserAndRestore(1); + + ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); + ASSERT_EQ(2, window_count); + + scoped_refptr<BrowserProxy> browser_proxy1( + automation()->GetBrowserWindow(0)); + ASSERT_TRUE(browser_proxy1.get()); + + scoped_refptr<BrowserProxy> browser_proxy2( + automation()->GetBrowserWindow(1)); + ASSERT_TRUE(browser_proxy2.get()); + + BrowserProxy::Type type1, type2; + ASSERT_TRUE(browser_proxy1->GetType(&type1)); + ASSERT_TRUE(browser_proxy2->GetType(&type2)); + + // The order of whether the normal window or popup is first depends upon + // activation order, which is not necessarily consistant across runs. + if (type1 == BrowserProxy::TYPE_NORMAL) { + EXPECT_EQ(type2, BrowserProxy::TYPE_POPUP); + } else { + EXPECT_EQ(type1, BrowserProxy::TYPE_POPUP); + EXPECT_EQ(type2, BrowserProxy::TYPE_NORMAL); + } +} + + #if defined(OS_WIN) // Creates a browser, goes incognito, closes browser, launches and make sure // we don't restore. @@ -308,7 +357,8 @@ TEST_F(SessionRestoreUITest, TwoWindowsCloseOneRestoreOnlyOne) { ASSERT_EQ(1, window_count); // Open a second window. - ASSERT_TRUE(automation()->OpenNewBrowserWindow(true)); + ASSERT_TRUE(automation()->OpenNewBrowserWindow(BrowserProxy::TYPE_NORMAL, + true)); ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); ASSERT_EQ(2, window_count); |