summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-30 15:22:45 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-30 15:22:45 +0000
commit076bf500c06a2ec9ce9f5accc0eaad7c0b0b2666 (patch)
tree90c75e38f905641cda5eff21273c76e9f80b4ca5 /chrome/browser
parent09247ce046ae7fa18a868d7f07ad292899b3798c (diff)
downloadchromium_src-076bf500c06a2ec9ce9f5accc0eaad7c0b0b2666.zip
chromium_src-076bf500c06a2ec9ce9f5accc0eaad7c0b0b2666.tar.gz
chromium_src-076bf500c06a2ec9ce9f5accc0eaad7c0b0b2666.tar.bz2
Cleanup in automation. Remove WaitForTabCountToChange.
WaitForTabCountToBecome is easier to use and more reliable. Also removed Windows2000-specific code from accessibility unit tests. Review URL: http://codereview.chromium.org/45070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12774 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/sessions/session_restore_uitest.cc22
-rw-r--r--chrome/browser/tab_restore_uitest.cc45
-rw-r--r--chrome/browser/views/tabs/tab_dragging_test.cc26
3 files changed, 38 insertions, 55 deletions
diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc
index 431b66e..58bee39 100644
--- a/chrome/browser/sessions/session_restore_uitest.cc
+++ b/chrome/browser/sessions/session_restore_uitest.cc
@@ -377,23 +377,24 @@ TEST_F(SessionRestoreUITest, DISABLED_ShareProcessesOnRestore) {
ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
// Create two new tabs.
- int new_tab_count;
ASSERT_TRUE(browser_proxy->ApplyAccelerator(IDC_NEW_TAB));
- ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(tab_count, &new_tab_count,
+ ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(tab_count + 1,
action_timeout_ms()));
- scoped_ptr<TabProxy> last_tab(browser_proxy->GetTab(new_tab_count - 1));
+ ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
+ scoped_ptr<TabProxy> last_tab(browser_proxy->GetTab(tab_count - 1));
ASSERT_TRUE(last_tab.get() != NULL);
// Do a reload to ensure new tab page has loaded.
ASSERT_TRUE(last_tab->Reload());
- tab_count = new_tab_count;
ASSERT_TRUE(browser_proxy->ApplyAccelerator(IDC_NEW_TAB));
- ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(tab_count, &new_tab_count,
+ ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(tab_count + 1,
action_timeout_ms()));
- last_tab.reset(browser_proxy->GetTab(new_tab_count - 1));
+ ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
+ last_tab.reset(browser_proxy->GetTab(tab_count - 1));
ASSERT_TRUE(last_tab.get() != NULL);
// Do a reload to ensure new tab page has loaded.
ASSERT_TRUE(last_tab->Reload());
int expected_process_count = GetBrowserProcessCount();
+ int expected_tab_count = tab_count;
// Restart.
browser_proxy.reset();
@@ -404,14 +405,13 @@ TEST_F(SessionRestoreUITest, DISABLED_ShareProcessesOnRestore) {
// count matches.
browser_proxy.reset(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser_proxy.get() != NULL);
- int restored_tab_count;
- ASSERT_TRUE(browser_proxy->GetTabCount(&restored_tab_count));
- ASSERT_EQ(new_tab_count, restored_tab_count);
+ ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
+ ASSERT_EQ(expected_tab_count, tab_count);
- scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(restored_tab_count - 2));
+ scoped_ptr<TabProxy> tab_proxy(browser_proxy->GetTab(tab_count - 2));
ASSERT_TRUE(tab_proxy.get() != NULL);
ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
- tab_proxy.reset(browser_proxy->GetTab(restored_tab_count - 1));
+ tab_proxy.reset(browser_proxy->GetTab(tab_count - 1));
ASSERT_TRUE(tab_proxy.get() != NULL);
ASSERT_TRUE(tab_proxy->WaitForTabToBeRestored(action_timeout_ms()));
diff --git a/chrome/browser/tab_restore_uitest.cc b/chrome/browser/tab_restore_uitest.cc
index 88bf499..34922e6 100644
--- a/chrome/browser/tab_restore_uitest.cc
+++ b/chrome/browser/tab_restore_uitest.cc
@@ -37,16 +37,14 @@ class TabRestoreUITest : public UITest {
// Restore the tab.
ASSERT_TRUE(browser_proxy->ApplyAccelerator(IDC_RESTORE_TAB));
+ ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(
+ tab_count + 1, action_max_timeout_ms()));
// Get a handle to the restored tab.
- int restored_tab_count;
- ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(
- tab_count, &restored_tab_count, action_max_timeout_ms()));
- ASSERT_EQ(tab_count + 1, restored_tab_count);
-
- // Wait for the restored tab to finish loading.
+ ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
scoped_ptr<TabProxy> restored_tab_proxy(
- browser_proxy->GetTab(restored_tab_count - 1));
+ browser_proxy->GetTab(tab_count - 1));
+ // Wait for the restored tab to finish loading.
ASSERT_TRUE(restored_tab_proxy->WaitForTabToBeRestored(
action_max_timeout_ms()));
}
@@ -61,16 +59,15 @@ class TabRestoreUITest : public UITest {
TEST_F(TabRestoreUITest, Basic) {
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
- int initial_tab_count;
- ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count));
+ int tab_count;
+ ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
// Add a tab
browser_proxy->AppendTab(url1_);
- int new_tab_count;
- ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count,
- &new_tab_count,
+ ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(tab_count + 1,
action_max_timeout_ms()));
- scoped_ptr<TabProxy> new_tab(browser_proxy->GetTab(new_tab_count - 1));
+ ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
+ scoped_ptr<TabProxy> new_tab(browser_proxy->GetTab(tab_count - 1));
// Make sure we're at url.
new_tab->NavigateToURL(url1_);
// Close the tab.
@@ -140,16 +137,15 @@ TEST_F(TabRestoreUITest, RestoreWithExistingSiteInstance) {
GURL http_url2(server->TestServerPageW(L"files/title2.html"));
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
- int initial_tab_count;
- ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count));
+ int tab_count;
+ ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
// Add a tab
browser_proxy->AppendTab(http_url1);
- int new_tab_count;
- ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count,
- &new_tab_count,
+ ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(tab_count + 1,
action_max_timeout_ms()));
- scoped_ptr<TabProxy> tab(browser_proxy->GetTab(new_tab_count - 1));
+ ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
+ scoped_ptr<TabProxy> tab(browser_proxy->GetTab(tab_count - 1));
// Navigate to another same-site URL.
tab->NavigateToURL(http_url2);
@@ -185,16 +181,15 @@ TEST_F(TabRestoreUITest, RestoreCrossSiteWithExistingSiteInstance) {
GURL http_url2(server->TestServerPageW(L"files/title2.html"));
scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
- int initial_tab_count;
- ASSERT_TRUE(browser_proxy->GetTabCount(&initial_tab_count));
+ int tab_count;
+ ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
// Add a tab
browser_proxy->AppendTab(http_url1);
- int new_tab_count;
- ASSERT_TRUE(browser_proxy->WaitForTabCountToChange(initial_tab_count,
- &new_tab_count,
+ ASSERT_TRUE(browser_proxy->WaitForTabCountToBecome(tab_count + 1,
action_max_timeout_ms()));
- scoped_ptr<TabProxy> tab(browser_proxy->GetTab(new_tab_count - 1));
+ ASSERT_TRUE(browser_proxy->GetTabCount(&tab_count));
+ scoped_ptr<TabProxy> tab(browser_proxy->GetTab(tab_count - 1));
// Navigate to more URLs, then a cross-site URL.
tab->NavigateToURL(http_url2);
diff --git a/chrome/browser/views/tabs/tab_dragging_test.cc b/chrome/browser/views/tabs/tab_dragging_test.cc
index c0471c8..dba2765 100644
--- a/chrome/browser/views/tabs/tab_dragging_test.cc
+++ b/chrome/browser/views/tabs/tab_dragging_test.cc
@@ -56,12 +56,9 @@ TEST_F(TabDraggingTest, Tab1Tab2) {
scoped_ptr<TabProxy> tab3(browser->GetTab(2));
ASSERT_TRUE(tab3.get());
- // Make sure 3 tabs are open
- int final_tab_count = 0;
- ASSERT_TRUE(browser->WaitForTabCountToChange(initial_tab_count,
- &final_tab_count,
+ // Make sure 3 tabs are open.
+ ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2,
10000));
- ASSERT_TRUE(final_tab_count == initial_tab_count + 2);
// Get bounds for the tabs.
gfx::Rect bounds1;
@@ -159,12 +156,9 @@ TEST_F(TabDraggingTest, Tab1Tab3) {
scoped_ptr<TabProxy> tab3(browser->GetTab(2));
ASSERT_TRUE(tab3.get());
- // Make sure 3 tabs are open
- int final_tab_count = 0;
- ASSERT_TRUE(browser->WaitForTabCountToChange(initial_tab_count,
- &final_tab_count,
+ // Make sure 3 tabs are open.
+ ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2,
10000));
- ASSERT_TRUE(final_tab_count == initial_tab_count + 2);
// Get bounds for the tabs.
gfx::Rect bounds1;
@@ -269,12 +263,9 @@ TEST_F(TabDraggingTest, Tab1Tab3Escape) {
scoped_ptr<TabProxy> tab3(browser->GetTab(2));
ASSERT_TRUE(tab3.get());
- // Make sure 3 tabs are open
- int final_tab_count = 0;
- ASSERT_TRUE(browser->WaitForTabCountToChange(initial_tab_count,
- &final_tab_count,
+ // Make sure 3 tabs are open.
+ ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2,
10000));
- ASSERT_TRUE(final_tab_count == initial_tab_count + 2);
// Get bounds for the tabs.
gfx::Rect bounds1;
@@ -383,11 +374,8 @@ TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
ASSERT_TRUE(tab3.get());
// Make sure 3 tabs are opened.
- int final_tab_count = 0;
- ASSERT_TRUE(browser->WaitForTabCountToChange(initial_tab_count,
- &final_tab_count,
+ ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2,
10000));
- ASSERT_TRUE(final_tab_count == initial_tab_count + 2);
// Make sure all the tab URL specs are different.
ASSERT_TRUE(tab1_url != tab2_url);