summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 22:25:27 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 22:25:27 +0000
commit9ebc96929053724b02f598290f469f1d8373a2b6 (patch)
treeda78645c9d1a28e3a98d92d9096b1fa5aa9e4de6
parent9ffcccf40f192a9b172f86203ce5a4e0cff4320c (diff)
downloadchromium_src-9ebc96929053724b02f598290f469f1d8373a2b6.zip
chromium_src-9ebc96929053724b02f598290f469f1d8373a2b6.tar.gz
chromium_src-9ebc96929053724b02f598290f469f1d8373a2b6.tar.bz2
Revert "First part of automated_ui_tests improvements."
Revert "Fix Mac by disabling some UI tests on it." Too many failures. TBR=huanr Review URL: http://codereview.chromium.org/193118 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26281 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/automation_provider.cc21
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_test_base.cc46
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_test_base.h27
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_test_test.cc99
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.cc30
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.h30
-rw-r--r--chrome/test/ui/ui_test.cc5
-rwxr-xr-xchrome/tools/automated_ui_test_tools/auto_ui_test_input_generator.py5
-rw-r--r--chrome/tools/automated_ui_test_tools/possible_actions.txt4
9 files changed, 65 insertions, 202 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index b461636..7e0d803 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -761,31 +761,10 @@ void AutomationProvider::ExecuteBrowserCommandAsync(int handle, int command,
void AutomationProvider::ExecuteBrowserCommand(
int handle, int command, IPC::Message* reply_message) {
- // List of commands which just finish synchronously and don't require
- // setting up an observer.
- static const int kSynchronousCommands[] = {
- IDC_HOME,
- IDC_SELECT_NEXT_TAB,
- IDC_SELECT_PREVIOUS_TAB,
- IDC_SHOW_DOWNLOADS,
- IDC_SHOW_HISTORY,
- };
if (browser_tracker_->ContainsHandle(handle)) {
Browser* browser = browser_tracker_->GetResource(handle);
if (browser->command_updater()->SupportsCommand(command) &&
browser->command_updater()->IsCommandEnabled(command)) {
- // First check if we can handle the command without using an observer.
- for (size_t i = 0; i < arraysize(kSynchronousCommands); i++) {
- if (command == kSynchronousCommands[i]) {
- browser->ExecuteCommand(command);
- AutomationMsg_WindowExecuteCommand::WriteReplyParams(reply_message,
- true);
- Send(reply_message);
- return;
- }
- }
-
- // Use an observer if we have one, otherwise fail.
if (ExecuteBrowserCommandObserver::CreateAndRegisterObserver(
this, browser, command, reply_message)) {
browser->ExecuteCommand(command);
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 5f2ef95..bf39831 100644
--- a/chrome/test/automated_ui_tests/automated_ui_test_base.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_test_base.cc
@@ -241,13 +241,6 @@ bool AutomatedUITestBase::DragActiveTab(bool drag_right) {
}
#endif
-bool AutomatedUITestBase::FindInPage() {
- if (!RunCommandAsync(IDC_FIND))
- return false;
-
- return WaitForFindWindowVisibilityChange(active_browser(), true);
-}
-
bool AutomatedUITestBase::ForwardButton() {
return RunCommand(IDC_FORWARD);
}
@@ -256,10 +249,6 @@ bool AutomatedUITestBase::GoOffTheRecord() {
return RunCommand(IDC_NEW_INCOGNITO_WINDOW);
}
-bool AutomatedUITestBase::Home() {
- return RunCommand(IDC_HOME);
-}
-
bool AutomatedUITestBase::OpenAndActivateNewBrowserWindow(
scoped_refptr<BrowserProxy>* previous_browser) {
if (!automation()->OpenNewBrowserWindow(true /* SW_SHOWNORMAL */)) {
@@ -328,41 +317,6 @@ bool AutomatedUITestBase::RestoreTab() {
return RunCommand(IDC_RESTORE_TAB);
}
-bool AutomatedUITestBase::SelectNextTab() {
- return RunCommand(IDC_SELECT_NEXT_TAB);
-}
-
-bool AutomatedUITestBase::SelectPreviousTab() {
- return RunCommand(IDC_SELECT_PREVIOUS_TAB);
-}
-
-bool AutomatedUITestBase::ShowBookmarkBar() {
- bool is_visible;
- bool is_animating;
- if (!active_browser()->GetBookmarkBarVisibility(&is_visible,
- &is_animating)) {
- return false;
- }
-
- if (is_visible) {
- // If the bar is visible, then issuing the command again will toggle it.
- return true;
- }
-
- if (!RunCommandAsync(IDC_SHOW_BOOKMARK_BAR))
- return false;
-
- return WaitForBookmarkBarVisibilityChange(active_browser(), true);
-}
-
-bool AutomatedUITestBase::ShowDownloads() {
- return RunCommand(IDC_SHOW_DOWNLOADS);
-}
-
-bool AutomatedUITestBase::ShowHistory() {
- return RunCommand(IDC_SHOW_HISTORY);
-}
-
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 c4b9429..cc4fb8648 100644
--- a/chrome/test/automated_ui_tests/automated_ui_test_base.h
+++ b/chrome/test/automated_ui_tests/automated_ui_test_base.h
@@ -57,9 +57,6 @@ class AutomatedUITestBase : public UITest {
// drag the active tab over.
bool DragActiveTab(bool drag_right);
- // Activates "find in page" on the current page. Returns true on success.
- bool FindInPage();
-
// Go forward in active tab.
// Returns true if successful, false otherwise.
bool ForwardButton();
@@ -67,10 +64,6 @@ class AutomatedUITestBase : public UITest {
// Opens an OffTheRecord browser window.
bool GoOffTheRecord();
- // Navigates to the Home page.
- // Returns true if call to activate the accelerator is successful.
- bool Home();
-
// Navigates the activate tab to given url.
bool Navigate(const GURL& url);
@@ -95,26 +88,6 @@ class AutomatedUITestBase : public UITest {
// Returns true if the tab is successfully restored.
bool RestoreTab();
- // Activates the next tab on the active browser window.
- // Returns true on success.
- bool SelectNextTab();
-
- // Activates the previous tab on the active browser window.
- // Returns true on success.
- bool SelectPreviousTab();
-
- // Displays the bookmark bar.
- // Returns true on success.
- bool ShowBookmarkBar();
-
- // Opens the Downloads page in the current active browser window.
- // Returns true on success.
- bool ShowDownloads();
-
- // Opens the History page in the current active browser window.
- // Returns true on success.
- bool ShowHistory();
-
// 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 b437245d..383a1e7 100644
--- a/chrome/test/automated_ui_tests/automated_ui_test_test.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_test_test.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "chrome/app/chrome_dll_resource.h"
-#include "chrome/common/url_constants.h"
#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"
@@ -33,32 +32,6 @@
#define MAYBE_CloseBrowserWindow CloseBrowserWindow
#endif
-// TODO(phajdan.jr): Enable FindInPageTest on Mac.
-#if !defined(OS_MACOSX)
-TEST_F(AutomatedUITestBase, FindInPage) {
- ASSERT_TRUE(FindInPage());
- bool is_visible;
- ASSERT_TRUE(active_browser()->IsFindWindowFullyVisible(&is_visible));
- EXPECT_TRUE(is_visible);
-}
-#endif // !defined(OS_MACOSX)
-
-TEST_F(AutomatedUITestBase, Home) {
- FilePath path_prefix(test_data_directory_.AppendASCII("session_history"));
- GURL bot1(net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")));
- NavigateToURL(bot1); // To help verify that Home does something.
-
- ASSERT_TRUE(Home());
-
- GURL url;
- ASSERT_TRUE(active_browser()->GetActiveTab()->GetCurrentURL(&url));
- EXPECT_EQ(GURL(chrome::kAboutBlankURL), url);
-
- std::wstring title;
- ASSERT_TRUE(active_browser()->GetActiveTab()->GetTabTitle(&title));
- EXPECT_EQ(L"", title);
-}
-
TEST_F(AutomatedUITestBase, NewTab) {
int tab_count;
active_browser()->GetTabCount(&tab_count);
@@ -321,75 +294,3 @@ TEST_F(AutomatedUITestBase, Navigate) {
ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
ASSERT_EQ(url2, url);
}
-
-TEST_F(AutomatedUITestBase, SelectTab) {
- FilePath filename(test_data_directory_);
- filename = filename.AppendASCII("title2.html");
- GURL url = net::FilePathToFileURL(filename);
-
- ASSERT_TRUE(active_browser()->AppendTab(url));
- ASSERT_TRUE(active_browser()->AppendTab(url));
-
- int active_tab_index;
- ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
- ASSERT_EQ(2, active_tab_index);
-
- ASSERT_TRUE(SelectNextTab());
- ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
- ASSERT_EQ(0, active_tab_index);
-
- ASSERT_TRUE(SelectNextTab());
- ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
- ASSERT_EQ(1, active_tab_index);
-
- ASSERT_TRUE(SelectPreviousTab());
- ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
- ASSERT_EQ(0, active_tab_index);
-
- ASSERT_TRUE(SelectPreviousTab());
- ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
- ASSERT_EQ(2, active_tab_index);
-
- ASSERT_TRUE(SelectPreviousTab());
- ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
- ASSERT_EQ(1, active_tab_index);
-
- ASSERT_TRUE(SelectNextTab());
- ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
- ASSERT_EQ(2, active_tab_index);
-}
-
-// TODO(phajdan.jr): Enable ShowBookmarkBar on Mac.
-#if !defined(OS_MACOSX)
-TEST_F(AutomatedUITestBase, ShowBookmarkBar) {
- ASSERT_TRUE(ShowBookmarkBar());
- bool is_visible;
- bool is_animating;
- ASSERT_TRUE(active_browser()->GetBookmarkBarVisibility(&is_visible,
- &is_animating));
- ASSERT_TRUE(is_visible);
- ASSERT_FALSE(is_animating);
-
- // Try second time to make sure it won't make the bookmark bar
- // disappear.
- ASSERT_TRUE(ShowBookmarkBar());
- ASSERT_TRUE(active_browser()->GetBookmarkBarVisibility(&is_visible,
- &is_animating));
- ASSERT_TRUE(is_visible);
- ASSERT_FALSE(is_animating);
-}
-#endif // !defined(OS_MACOSX)
-
-TEST_F(AutomatedUITestBase, ShowDownloads) {
- ASSERT_TRUE(ShowDownloads());
- GURL url;
- ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
- ASSERT_EQ(GURL(chrome::kChromeUIDownloadsURL), url);
-}
-
-TEST_F(AutomatedUITestBase, ShowHistory) {
- ASSERT_TRUE(ShowHistory());
- GURL url;
- ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
- ASSERT_EQ(GURL(chrome::kChromeUIHistoryURL), url);
-}
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc
index 394b91c..02afb67 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc
@@ -425,8 +425,6 @@ bool AutomatedUITest::DoAction(const std::string& action) {
<< action.c_str();
}
- EXPECT_TRUE(did_complete_action) << action;
-
if (!did_complete_action)
xml_writer_.AddAttribute("failed_to_complete", "yes");
xml_writer_.EndElement();
@@ -457,6 +455,14 @@ bool AutomatedUITest::ChangeEncoding() {
return RunCommandAsync((*encodings)[index].encoding_id);
}
+bool AutomatedUITest::FindInPage() {
+ return RunCommandAsync(IDC_FIND);
+}
+
+bool AutomatedUITest::Home() {
+ return RunCommandAsync(IDC_HOME);
+}
+
bool AutomatedUITest::JavaScriptConsole() {
return RunCommandAsync(IDC_DEV_TOOLS);
}
@@ -521,6 +527,26 @@ bool AutomatedUITest::PressUpArrow() {
return SimulateKeyPressInActiveWindow(base::VKEY_UP, 0);
}
+bool AutomatedUITest::SelectNextTab() {
+ return RunCommandAsync(IDC_SELECT_NEXT_TAB);
+}
+
+bool AutomatedUITest::SelectPreviousTab() {
+ return RunCommandAsync(IDC_SELECT_PREVIOUS_TAB);
+}
+
+bool AutomatedUITest::ShowBookmarkBar() {
+ return RunCommandAsync(IDC_SHOW_BOOKMARK_BAR);
+}
+
+bool AutomatedUITest::ShowDownloads() {
+ return RunCommandAsync(IDC_SHOW_DOWNLOADS);
+}
+
+bool AutomatedUITest::ShowHistory() {
+ return RunCommandAsync(IDC_SHOW_HISTORY);
+}
+
bool AutomatedUITest::StarPage() {
return RunCommandAsync(IDC_STAR);
}
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.h b/chrome/test/automated_ui_tests/automated_ui_tests.h
index d370b70..1db44bb 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.h
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.h
@@ -141,6 +141,15 @@ class AutomatedUITest : public AutomatedUITestBase {
// XML element: <Dialog/>
bool ExerciseDialog();
+ // Activates "find in page" on the current page.
+ // XML element: <FindInPage/>
+ bool FindInPage();
+
+ // Navigates to the Home page.
+ // Returns true if call to activate the accelerator is successful.
+ // XML element: <Home/>
+ bool Home();
+
// Opens the JavaScriptConsole window. While it isn't modal, it takes focus
// from the current browser window, so most of the test can't continue until
// it is dismissed.
@@ -217,6 +226,27 @@ class AutomatedUITest : public AutomatedUITestBase {
// XML element: <UpArrow/>
bool PressUpArrow();
+ // Activates the next tab on the active browser window.
+ // XML element: <SelectNextTab/>
+ bool SelectNextTab();
+
+ // Activates the previous tab on the active browser window.
+ // XML element: <SelectPrevTab/>
+ bool SelectPreviousTab();
+
+ // Displays the bookmark bar.
+ // Returns true if call to activate the accelerator is successful.
+ // XML element: <ShowBookmarks/>
+ bool ShowBookmarkBar();
+
+ // Opens the Downloads page in the current active browser window.
+ // XML element: <Downloads/>
+ bool ShowDownloads();
+
+ // Opens the History page in the current active browser window.
+ // XML element: <History/>
+ bool ShowHistory();
+
// Stars the current page. This opens a dialog that may or may not be
// dismissed.
// XML element: <Star/>
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index cacd59d0..b59d71f 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -500,6 +500,10 @@ bool UITest::WaitForDownloadShelfVisibilityChange(BrowserProxy* browser,
return false;
}
+// TODO(port): this #if effectively cuts out half of this file on
+// non-Windows platforms, and is a temporary hack to get things
+// building.
+#if defined(OS_WIN)
bool UITest::WaitForFindWindowVisibilityChange(BrowserProxy* browser,
bool wait_for_open) {
const int kCycles = 10;
@@ -532,6 +536,7 @@ bool UITest::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser,
}
return false;
}
+#endif // defined(OS_WIN)
GURL UITest::GetActiveTabURL(int window_index) {
scoped_refptr<TabProxy> tab_proxy(GetActiveTab(window_index));
diff --git a/chrome/tools/automated_ui_test_tools/auto_ui_test_input_generator.py b/chrome/tools/automated_ui_test_tools/auto_ui_test_input_generator.py
index 4c335e6..df9bc22 100755
--- a/chrome/tools/automated_ui_test_tools/auto_ui_test_input_generator.py
+++ b/chrome/tools/automated_ui_test_tools/auto_ui_test_input_generator.py
@@ -245,10 +245,7 @@ class AutomatedTestInputGenerator:
def __init__(self):
(options,args) = ParseCommandLine()
input_file = open(options.input_file_name)
- actions_list = []
- for line in input_file.readlines():
- if not line.startswith('#'):
- actions_list.append(line)
+ actions_list = input_file.readlines()
input_file.close()
self.__commands_per_file = options.commands_per_file
diff --git a/chrome/tools/automated_ui_test_tools/possible_actions.txt b/chrome/tools/automated_ui_test_tools/possible_actions.txt
index c69406f9..9e5ad61 100644
--- a/chrome/tools/automated_ui_test_tools/possible_actions.txt
+++ b/chrome/tools/automated_ui_test_tools/possible_actions.txt
@@ -1,4 +1,3 @@
-# Please keep the list sorted.
Back
ChangeEncoding
CloseTab
@@ -17,8 +16,7 @@ DragTabRight
DragTabOut
OpenWindow
Reload
-# Disabled, it doesn't work reliably (http://crbug.com/21636).
-# RestoreTab
+RestoreTab
SelectNextTab
SelectPrevTab
ShowBookmarks