diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-14 15:51:10 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-14 15:51:10 +0000 |
commit | be3877f74da87b5be2b549f733b5705c9607ec82 (patch) | |
tree | a00fa6c37daf0467801e2cbb06660b360a6d449e /chrome/browser/browser_uitest.cc | |
parent | 57a020e92927a379ab514db5836cb4550e6e444b (diff) | |
download | chromium_src-be3877f74da87b5be2b549f733b5705c9607ec82.zip chromium_src-be3877f74da87b5be2b549f733b5705c9607ec82.tar.gz chromium_src-be3877f74da87b5be2b549f733b5705c9607ec82.tar.bz2 |
Provides the infrastructure for Browser unit tests that create a
BrowserWindow with only a TabStrip. I also converted two ui tests over
to unit tests to make sure it all worked. I had to add a bunch of null
checks to Browser and a couple of other places.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/17386
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8007 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_uitest.cc')
-rw-r--r-- | chrome/browser/browser_uitest.cc | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index b3ad491..4574c17 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -123,49 +123,6 @@ TEST_F(BrowserTest, WindowsSessionEnd) { ASSERT_TRUE(exited_cleanly); } -// Tests the accelerators for tab navigation. Specifically IDC_SELECT_NEXT_TAB, -// IDC_SELECT_PREV_TAB, IDC_SELECT_TAB_0, and IDC_SELECT_LAST_TAB. -TEST_F(BrowserTest, TabNavigationAccelerators) { - scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); - ASSERT_TRUE(window.get()); - - // Create two new tabs. This way we'll have at least three tabs to navigate - // to. - int old_tab_count = -1; - ASSERT_TRUE(window->GetTabCount(&old_tab_count)); - ASSERT_TRUE(window->ApplyAccelerator(IDC_NEW_TAB)); - int new_tab_count; - ASSERT_TRUE(window->WaitForTabCountToChange(old_tab_count, - &new_tab_count, - action_max_timeout_ms())); - ASSERT_TRUE(window->ApplyAccelerator(IDC_NEW_TAB)); - old_tab_count = new_tab_count; - ASSERT_TRUE(window->WaitForTabCountToChange(old_tab_count, - &new_tab_count, - action_max_timeout_ms())); - ASSERT_GE(new_tab_count, 2); - - // Activate the second tab. - ASSERT_TRUE(window->ActivateTab(1)); - - // Navigate to the first tab using an accelerator. - ASSERT_TRUE(window->ApplyAccelerator(IDC_SELECT_TAB_0)); - ASSERT_TRUE(window->WaitForTabToBecomeActive(0, action_max_timeout_ms())); - - // Navigate to the second tab using the next accelerators. - ASSERT_TRUE(window->ApplyAccelerator(IDC_SELECT_NEXT_TAB)); - ASSERT_TRUE(window->WaitForTabToBecomeActive(1, action_max_timeout_ms())); - - // Navigate back to the first tab using the previous accelerators. - ASSERT_TRUE(window->ApplyAccelerator(IDC_SELECT_PREVIOUS_TAB)); - ASSERT_TRUE(window->WaitForTabToBecomeActive(0, action_max_timeout_ms())); - - // Navigate to the last tab using the select last accelerator. - ASSERT_TRUE(window->ApplyAccelerator(IDC_SELECT_LAST_TAB)); - ASSERT_TRUE(window->WaitForTabToBecomeActive(new_tab_count - 1, - action_max_timeout_ms())); -} - TEST_F(BrowserTest, JavascriptAlertActivatesTab) { scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); int start_index; @@ -183,53 +140,6 @@ TEST_F(BrowserTest, JavascriptAlertActivatesTab) { action_max_timeout_ms())); } -TEST_F(BrowserTest, DuplicateTab) { - std::wstring path_prefix = test_data_directory_; - file_util::AppendToPath(&path_prefix, L"session_history"); - path_prefix += FilePath::kSeparators[0]; - GURL url1 = net::FilePathToFileURL(path_prefix + L"bot1.html"); - GURL url2 = net::FilePathToFileURL(path_prefix + L"bot2.html"); - GURL url3 = GURL("about:blank"); - - scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); - - // Navigate to the three urls, then go back. - scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(0)); - tab_proxy->NavigateToURL(url1); - tab_proxy->NavigateToURL(url2); - tab_proxy->NavigateToURL(url3); - ASSERT_TRUE(tab_proxy->GoBack()); - - int initial_window_count; - ASSERT_TRUE(automation()->GetBrowserWindowCount(&initial_window_count)); - - // Duplicate the tab. - ASSERT_TRUE(browser_proxy->ApplyAccelerator(IDC_DUPLICATE_TAB)); - - // The duplicated tab should not end up in a new window. - int window_count; - ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count)); - ASSERT_TRUE(window_count == initial_window_count); - - tab_proxy.reset(browser_proxy->GetTab(1)); - ASSERT_TRUE(tab_proxy != NULL); - ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms())); - - // Verify the stack of urls. - GURL url; - ASSERT_TRUE(tab_proxy->GetCurrentURL(&url)); - ASSERT_EQ(url2, url); - - ASSERT_TRUE(tab_proxy->GoForward()); - ASSERT_TRUE(tab_proxy->GetCurrentURL(&url)); - ASSERT_EQ(url3, url); - - ASSERT_TRUE(tab_proxy->GoBack()); - ASSERT_TRUE(tab_proxy->GoBack()); - ASSERT_TRUE(tab_proxy->GetCurrentURL(&url)); - ASSERT_EQ(url1, url); -} - // Test that scripts can fork a new renderer process for a tab in a particular // case (which matches following a link in Gmail). The script must open a new // tab, set its window.opener to null, and redirect it to a cross-site URL. |