From f8fc5885250b5cbe1026b13b23452d278b8c058e Mon Sep 17 00:00:00 2001 From: "huanr@chromium.org" Date: Wed, 6 May 2009 04:23:43 +0000 Subject: Make RestoreTab synchronuous. Review URL: http://codereview.chromium.org/109053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15379 0039d316-1c4b-4281-b951-d872f2087c98 --- .../test/automated_ui_tests/automated_ui_test_base.cc | 4 ++++ .../test/automated_ui_tests/automated_ui_test_base.h | 4 ++++ .../test/automated_ui_tests/automated_ui_test_test.cc | 18 ++++++++++++++++++ chrome/test/automated_ui_tests/automated_ui_tests.cc | 4 ---- chrome/test/automated_ui_tests/automated_ui_tests.h | 5 ----- 5 files changed, 26 insertions(+), 9 deletions(-) (limited to 'chrome/test') diff --git a/chrome/test/automated_ui_tests/automated_ui_test_base.cc b/chrome/test/automated_ui_tests/automated_ui_test_base.cc index 0adebc6..5820275 100644 --- a/chrome/test/automated_ui_tests/automated_ui_test_base.cc +++ b/chrome/test/automated_ui_tests/automated_ui_test_base.cc @@ -112,6 +112,10 @@ bool AutomatedUITestBase::NewTab() { return RunCommand(IDC_NEW_TAB); } +bool AutomatedUITestBase::RestoreTab() { + return RunCommand(IDC_RESTORE_TAB); +} + bool AutomatedUITestBase::RunCommandAsync(int browser_command) { BrowserProxy* browser = active_browser(); if (NULL == browser) { diff --git a/chrome/test/automated_ui_tests/automated_ui_test_base.h b/chrome/test/automated_ui_tests/automated_ui_test_base.h index 0163b56..e454bec 100644 --- a/chrome/test/automated_ui_tests/automated_ui_test_base.h +++ b/chrome/test/automated_ui_tests/automated_ui_test_base.h @@ -50,6 +50,10 @@ class AutomatedUITestBase : public UITest { // caller owns previous_browser. bool OpenAndActivateNewBrowserWindow(BrowserProxy** previous_browser); + // Restores a previously closed tab. + // Returns true if the tab is successfully restored. + bool RestoreTab(); + // Runs the specified browser command in the current active browser. // See browser_commands.cc for the list of commands. // Returns true if the call is successfully dispatched. diff --git a/chrome/test/automated_ui_tests/automated_ui_test_test.cc b/chrome/test/automated_ui_tests/automated_ui_test_test.cc index 5256910..afaa97a 100644 --- a/chrome/test/automated_ui_tests/automated_ui_test_test.cc +++ b/chrome/test/automated_ui_tests/automated_ui_test_test.cc @@ -4,6 +4,7 @@ #include "chrome/test/automated_ui_tests/automated_ui_test_base.h" #include "chrome/test/automation/browser_proxy.h" +#include "chrome/test/automation/tab_proxy.h" #include "chrome/test/ui/ui_test.h" TEST_F(AutomatedUITestBase, NewTab) { @@ -30,6 +31,23 @@ TEST_F(AutomatedUITestBase, DuplicateTab) { ASSERT_EQ(3, tab_count); } +TEST_F(AutomatedUITestBase, RestoreTab) { + int tab_count; + active_browser()->GetTabCount(&tab_count); + ASSERT_EQ(1, tab_count); + NewTab(); + active_browser()->GetTabCount(&tab_count); + ASSERT_EQ(2, tab_count); + GURL test_url("about:blank"); + GetActiveTab()->NavigateToURL(test_url); + CloseActiveTab(); + active_browser()->GetTabCount(&tab_count); + ASSERT_EQ(1, tab_count); + RestoreTab(); + active_browser()->GetTabCount(&tab_count); + ASSERT_EQ(2, tab_count); +} + TEST_F(AutomatedUITestBase, OpenBrowserWindow) { int num_browser_windows; int tab_count; diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc index c35a68b..35d8dca 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.cc +++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc @@ -529,10 +529,6 @@ bool AutomatedUITest::ReloadPage() { return RunCommandAsync(IDC_RELOAD); } -bool AutomatedUITest::RestoreTab() { - return RunCommandAsync(IDC_RESTORE_TAB); -} - bool AutomatedUITest::SelectNextTab() { return RunCommandAsync(IDC_SELECT_NEXT_TAB); } diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.h b/chrome/test/automated_ui_tests/automated_ui_tests.h index 4219a96..c6b847d 100644 --- a/chrome/test/automated_ui_tests/automated_ui_tests.h +++ b/chrome/test/automated_ui_tests/automated_ui_tests.h @@ -254,11 +254,6 @@ class AutomatedUITest : public AutomatedUITestBase { // XML element: bool ReloadPage(); - // Restores a previously closed tab. - // Returns true if call to activate the accelerator is successful. - // XML element: - bool RestoreTab(); - // Activates the next tab on the active browser window. // XML element: bool SelectNextTab(); -- cgit v1.1