diff options
6 files changed, 28 insertions, 10 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index 395e02e..b14e286 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -499,7 +499,8 @@ struct CommandNotification { const struct CommandNotification command_notifications[] = { {IDC_DUPLICATE_TAB, NotificationType::TAB_PARENTED}, - {IDC_NEW_TAB, NotificationType::TAB_PARENTED} + {IDC_NEW_TAB, NotificationType::TAB_PARENTED}, + {IDC_RESTORE_TAB, NotificationType::TAB_PARENTED} }; } // namespace 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: <Reload/> bool ReloadPage(); - // Restores a previously closed tab. - // Returns true if call to activate the accelerator is successful. - // XML element: <RestoreTab/> - bool RestoreTab(); - // Activates the next tab on the active browser window. // XML element: <SelectNextTab/> bool SelectNextTab(); |