summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-08 03:01:54 +0000
committerfinnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-08 03:01:54 +0000
commitc99307d9a10b605a8321fc34cfe7f94f03df90da (patch)
tree01c90f9d5716a58de9a38647599c789070ab44ff /chrome/test
parent1f77de7176ccb8b1c097019642249c6e35988d45 (diff)
downloadchromium_src-c99307d9a10b605a8321fc34cfe7f94f03df90da.zip
chromium_src-c99307d9a10b605a8321fc34cfe7f94f03df90da.tar.gz
chromium_src-c99307d9a10b605a8321fc34cfe7f94f03df90da.tar.bz2
This is essentially a no functionality change to the Automated_ui test project. I renamed a few functions for clarity, reordered the functions in both the .cc and .h file alphabetically to see at a glance what commands are missing and did the same with the loop in DoAction that parses the input. That change actually flushed out two duplications (ie. "options" had two cases in the switch).
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@550 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.cc419
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.h233
2 files changed, 325 insertions, 327 deletions
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc
index ef73355..b7aeafd 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc
@@ -197,7 +197,7 @@ void AutomatedUITest::RunAutomatedUITest() {
DoAction("SetUp");
// Record the depth of the root of the command subtree, then advance to
- // the first element in preperation for parsing.
+ // the first element in preparation for parsing.
int start_depth = init_reader_.Depth();
ASSERT_TRUE(init_reader_.Read()) << "Malformed XML file.";
init_reader_.SkipToElement();
@@ -277,108 +277,104 @@ bool AutomatedUITest::DoAction(const std::string & action) {
if (debug_logging_enabled_)
AppendToOutputFile(action);
- if (LowerCaseEqualsASCII(action, "navigate")) {
- did_complete_action = Navigate();
- } else if (LowerCaseEqualsASCII(action, "newtab")) {
- did_complete_action = NewTab();
+ if (LowerCaseEqualsASCII(action, "about")) {
+ did_complete_action = OpenAboutDialog();
} else if (LowerCaseEqualsASCII(action, "back")) {
did_complete_action = BackButton();
- } else if (LowerCaseEqualsASCII(action, "forward")) {
- did_complete_action = ForwardButton();
} else if (LowerCaseEqualsASCII(action, "closetab")) {
did_complete_action = CloseActiveTab();
- } else if (LowerCaseEqualsASCII(action, "openwindow")) {
- did_complete_action = OpenAndActivateNewBrowserWindow();
- } else if (LowerCaseEqualsASCII(action, "reload")) {
- did_complete_action = ReloadPage();
- } else if (LowerCaseEqualsASCII(action, "star")) {
- did_complete_action = StarPage();
+ } else if (LowerCaseEqualsASCII(action, "clearbrowsingdata")) {
+ did_complete_action = OpenClearBrowsingDataDialog();
+ } else if (LowerCaseEqualsASCII(action, "crash")) {
+ did_complete_action = ForceCrash();
+ } else if (LowerCaseEqualsASCII(action, "dialog")) {
+ did_complete_action = ExerciseDialog();
+ } else if (LowerCaseEqualsASCII(action, "downarrow")) {
+ did_complete_action = PressDownArrow();
+ } else if (LowerCaseEqualsASCII(action, "downloads")) {
+ did_complete_action = ShowDownloads();
+ } else if (LowerCaseEqualsASCII(action, "dragtableft")) {
+ did_complete_action = DragActiveTab(false, false);
+ } else if (LowerCaseEqualsASCII(action, "dragtabout")) {
+ did_complete_action = DragActiveTab(false, true);
+ } else if (LowerCaseEqualsASCII(action, "dragtabright")) {
+ did_complete_action = DragActiveTab(true, false);
+ } else if (LowerCaseEqualsASCII(action, "editsearchengines")) {
+ did_complete_action = OpenEditSearchEnginesDialog();
} else if (LowerCaseEqualsASCII(action, "findinpage")) {
did_complete_action = FindInPage();
- } else if (LowerCaseEqualsASCII(action, "selectnexttab")) {
- did_complete_action = SelectNextTab();
- } else if (LowerCaseEqualsASCII(action, "selectprevtab")) {
- did_complete_action = SelectPreviousTab();
- } else if (LowerCaseEqualsASCII(action, "zoomplus")) {
- did_complete_action = ZoomPlus();
- } else if (LowerCaseEqualsASCII(action, "zoomminus")) {
- did_complete_action = ZoomMinus();
+ } else if (LowerCaseEqualsASCII(action, "forward")) {
+ did_complete_action = ForwardButton();
+ } else if (LowerCaseEqualsASCII(action, "goofftherecord")) {
+ did_complete_action = GoOffTheRecord();
} else if (LowerCaseEqualsASCII(action, "history")) {
did_complete_action = ShowHistory();
- } else if (LowerCaseEqualsASCII(action, "downloads")) {
- did_complete_action = ShowDownloads();
- } else if (LowerCaseEqualsASCII(action, "dialog")) {
- did_complete_action = ExerciseDialog();
- } else if (LowerCaseEqualsASCII(action, "viewpasswords")) {
- did_complete_action = ViewPasswords();
- } else if (LowerCaseEqualsASCII(action, "about")) {
- did_complete_action = About();
- } else if (LowerCaseEqualsASCII(action, "options")) {
- did_complete_action = Options();
- } else if (LowerCaseEqualsASCII(action, "taskmanager")) {
- did_complete_action = TaskManager();
- } else if (LowerCaseEqualsASCII(action, "clearbrowsingdata")) {
- did_complete_action = ClearBrowserData();
- } else if (LowerCaseEqualsASCII(action, "javascriptdebugger")) {
- did_complete_action = JavaScriptDebugger();
+ } else if (LowerCaseEqualsASCII(action, "import")) {
+ did_complete_action = OpenImportSettingsDialog();
} else if (LowerCaseEqualsASCII(action, "javascriptconsole")) {
did_complete_action = JavaScriptConsole();
- } else if (LowerCaseEqualsASCII(action, "import")) {
- did_complete_action = ImportSettings();
- } else if (LowerCaseEqualsASCII(action, "editsearchengines")) {
- did_complete_action = EditSearchEngines();
- } else if (LowerCaseEqualsASCII(action, "viewpasswords")) {
- did_complete_action = ViewPasswords();
- } else if (LowerCaseEqualsASCII(action, "goofftherecord")) {
- did_complete_action = GoOffTheRecord();
- } else if (LowerCaseEqualsASCII(action, "pressescapekey")) {
- did_complete_action = PressEscapeKey();
- } else if (LowerCaseEqualsASCII(action, "presstabkey")) {
- did_complete_action = PressTabKey();
+ } else if (LowerCaseEqualsASCII(action, "javascriptdebugger")) {
+ did_complete_action = JavaScriptDebugger();
+ } else if (LowerCaseEqualsASCII(action, "navigate")) {
+ did_complete_action = Navigate();
+ } else if (LowerCaseEqualsASCII(action, "newtab")) {
+ did_complete_action = NewTab();
+ } else if (LowerCaseEqualsASCII(action, "openwindow")) {
+ did_complete_action = OpenAndActivateNewBrowserWindow();
+ } else if (LowerCaseEqualsASCII(action, "options")) {
+ did_complete_action = Options();
+ } else if (LowerCaseEqualsASCII(action, "pagedown")) {
+ did_complete_action = PressPageDown();
+ } else if (LowerCaseEqualsASCII(action, "pageup")) {
+ did_complete_action = PressPageUp();
} else if (LowerCaseEqualsASCII(action, "pressenterkey")) {
did_complete_action = PressEnterKey();
+ } else if (LowerCaseEqualsASCII(action, "pressescapekey")) {
+ did_complete_action = PressEscapeKey();
} else if (LowerCaseEqualsASCII(action, "pressspacebar")) {
did_complete_action = PressSpaceBar();
- } else if (LowerCaseEqualsASCII(action, "pagedown")) {
- did_complete_action = PageDown();
- } else if (LowerCaseEqualsASCII(action, "pageup")) {
- did_complete_action = PageUp();
- } else if (LowerCaseEqualsASCII(action, "dragtabright")) {
- did_complete_action = DragActiveTab(true, false);
- } else if (LowerCaseEqualsASCII(action, "dragtableft")) {
- did_complete_action = DragActiveTab(false, false);
- } else if (LowerCaseEqualsASCII(action, "dragtabout")) {
- did_complete_action = DragActiveTab(false, true);
- } else if (LowerCaseEqualsASCII(action, "uparrow")) {
- did_complete_action = UpArrow();
- } else if (LowerCaseEqualsASCII(action, "downarrow")) {
- did_complete_action = DownArrow();
- } else if (LowerCaseEqualsASCII(action, "options")) {
- did_complete_action = Options();
- } else if (LowerCaseEqualsASCII(action, "testeditkeywords")) {
- did_complete_action = TestEditKeywords();
- } else if (LowerCaseEqualsASCII(action, "testtaskmanager")) {
- did_complete_action = TestTaskManager();
- } else if (LowerCaseEqualsASCII(action, "testoptions")) {
- did_complete_action = TestOptions();
- } else if (LowerCaseEqualsASCII(action, "testviewpasswords")) {
- did_complete_action = TestViewPasswords();
- } else if (LowerCaseEqualsASCII(action, "testclearbrowserdata")) {
- did_complete_action = TestClearBrowserData();
- } else if (LowerCaseEqualsASCII(action, "testimportsettings")) {
- did_complete_action = TestImportSettings();
- } else if (LowerCaseEqualsASCII(action, "crash")) {
- did_complete_action = ForceCrash();
+ } else if (LowerCaseEqualsASCII(action, "presstabkey")) {
+ did_complete_action = PressTabKey();
+ } else if (LowerCaseEqualsASCII(action, "reload")) {
+ did_complete_action = ReloadPage();
+ } else if (LowerCaseEqualsASCII(action, "selectnexttab")) {
+ did_complete_action = SelectNextTab();
+ } else if (LowerCaseEqualsASCII(action, "selectprevtab")) {
+ did_complete_action = SelectPreviousTab();
+ } else if (LowerCaseEqualsASCII(action, "setup")) {
+ LaunchBrowserAndServer();
+ did_complete_action = true;
} else if (LowerCaseEqualsASCII(action, "sleep")) {
// This is for debugging, it probably shouldn't be used real tests.
Sleep(kDebuggingTimeoutMsec);
did_complete_action = true;
- } else if (LowerCaseEqualsASCII(action, "setup")) {
- LaunchBrowserAndServer();
- did_complete_action = true;
+ } else if (LowerCaseEqualsASCII(action, "star")) {
+ did_complete_action = StarPage();
+ } else if (LowerCaseEqualsASCII(action, "taskmanager")) {
+ did_complete_action = OpenTaskManagerDialog();
} else if (LowerCaseEqualsASCII(action, "teardown")) {
CloseBrowserAndServer();
did_complete_action = true;
+ } else if (LowerCaseEqualsASCII(action, "testclearbrowserdata")) {
+ did_complete_action = TestClearBrowsingData();
+ } else if (LowerCaseEqualsASCII(action, "testeditkeywords")) {
+ did_complete_action = TestEditKeywords();
+ } else if (LowerCaseEqualsASCII(action, "testimportsettings")) {
+ did_complete_action = TestImportSettings();
+ } else if (LowerCaseEqualsASCII(action, "testoptions")) {
+ did_complete_action = TestOptions();
+ } else if (LowerCaseEqualsASCII(action, "testtaskmanager")) {
+ did_complete_action = TestTaskManager();
+ } else if (LowerCaseEqualsASCII(action, "testviewpasswords")) {
+ did_complete_action = TestViewPasswords();
+ } else if (LowerCaseEqualsASCII(action, "uparrow")) {
+ did_complete_action = PressUpArrow();
+ } else if (LowerCaseEqualsASCII(action, "viewpasswords")) {
+ did_complete_action = OpenViewPasswordsDialog();
+ } else if (LowerCaseEqualsASCII(action, "zoomplus")) {
+ did_complete_action = ZoomPlus();
+ } else if (LowerCaseEqualsASCII(action, "zoomminus")) {
+ did_complete_action = ZoomMinus();
}
if (!did_complete_action)
@@ -391,68 +387,34 @@ bool AutomatedUITest::DoAction(const std::string & action) {
return did_complete_action;
}
-bool AutomatedUITest::Navigate() {
- scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow());
- if (browser.get() == NULL) {
- AddErrorAttribute("browser_window_not_found");
- return false;
- }
- bool did_timeout;
- scoped_ptr<TabProxy> tab(
- browser->GetActiveTabWithTimeout(kWaitForActionMaxMsec, &did_timeout));
- // TODO(devint): This might be masking a bug. I can't think of many
- // valid cases where we would get a browser window, but not be able
- // to return an active tab. Yet this has happened and has triggered crashes.
- // Investigate this.
- if (tab.get() == NULL) {
- AddErrorAttribute("active_tab_not_found");
- return false;
- }
- std::string url = "about:blank";
- if (init_reader_.NodeAttribute("url", &url)) {
- xml_writer_.AddAttribute("url", url);
- }
- GURL test_url(url);
- did_timeout = false;
- tab->NavigateToURLWithTimeout(test_url, kMaxTestExecutionTime, &did_timeout);
-
- if (did_timeout) {
- AddWarningAttribute("timeout");
+bool AutomatedUITest::OpenAndActivateNewBrowserWindow() {
+ if (!automation()->OpenNewBrowserWindow(SW_SHOWNORMAL)) {
+ AddWarningAttribute("failed_to_open_new_browser_window");
return false;
}
- return true;
-}
-
-bool AutomatedUITest::NewTab() {
- scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow());
+ int num_browser_windows;
+ automation()->GetBrowserWindowCount(&num_browser_windows);
+ // Get the most recently opened browser window and activate the tab
+ // in order to activate this browser window.
+ scoped_ptr<BrowserProxy> browser(
+ automation()->GetBrowserWindow(num_browser_windows - 1));
if (browser.get() == NULL) {
AddErrorAttribute("browser_window_not_found");
return false;
}
- int old_tab_count;
- int new_tab_count;
bool is_timeout;
- browser->GetTabCountWithTimeout(&old_tab_count, kWaitForActionMaxMsec,
- &is_timeout);
- // Apply accelerator and wait for a new tab to open, if either
- // fails, return false. Apply Accelerator takes care of logging its failure.
- bool return_value = RunCommand(IDC_NEWTAB);
- if (!browser->WaitForTabCountToChange(
- old_tab_count, &new_tab_count, kWaitForActionMaxMsec)) {
- AddWarningAttribute("tab_count_failed_to_change");
+ if (!browser->ActivateTabWithTimeout(0, kWaitForActionMaxMsec,
+ &is_timeout)) {
+ AddWarningAttribute("failed_to_activate_tab");
return false;
}
- return return_value;
+ return true;
}
bool AutomatedUITest::BackButton() {
return RunCommand(IDC_BACK);
}
-bool AutomatedUITest::ForwardButton() {
- return RunCommand(IDC_FORWARD);
-}
-
bool AutomatedUITest::CloseActiveTab() {
bool return_value = false;
scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow());
@@ -492,175 +454,208 @@ bool AutomatedUITest::CloseActiveTab() {
return return_value;
}
-bool AutomatedUITest::OpenAndActivateNewBrowserWindow() {
- if (!automation()->OpenNewBrowserWindow(SW_SHOWNORMAL)) {
- AddWarningAttribute("failed_to_open_new_browser_window");
- return false;
- }
- int num_browser_windows;
- automation()->GetBrowserWindowCount(&num_browser_windows);
- // Get the most recently opened browser window and activate the tab
- // in order to activate this browser window.
- scoped_ptr<BrowserProxy> browser(
- automation()->GetBrowserWindow(num_browser_windows - 1));
- if (browser.get() == NULL) {
- AddErrorAttribute("browser_window_not_found");
- return false;
- }
- bool is_timeout;
- if (!browser->ActivateTabWithTimeout(0, kWaitForActionMaxMsec,
- &is_timeout)) {
- AddWarningAttribute("failed_to_activate_tab");
- return false;
- }
- return true;
-}
-
-bool AutomatedUITest::ReloadPage() {
- return RunCommand(IDC_RELOAD);
+bool AutomatedUITest::FindInPage() {
+ return RunCommand(IDC_FIND);
}
-bool AutomatedUITest::StarPage() {
- return RunCommand(IDC_STAR);
+bool AutomatedUITest::ForwardButton() {
+ return RunCommand(IDC_FORWARD);
}
-bool AutomatedUITest::FindInPage() {
- return RunCommand(IDC_FIND);
+bool AutomatedUITest::GoOffTheRecord() {
+ return RunCommand(IDC_GOOFFTHERECORD);
}
-bool AutomatedUITest::SelectNextTab() {
- return RunCommand(IDC_SELECT_NEXT_TAB);
+bool AutomatedUITest::JavaScriptConsole() {
+ return RunCommand(IDC_SHOW_JS_CONSOLE);
}
-bool AutomatedUITest::SelectPreviousTab() {
- return RunCommand(IDC_SELECT_PREV_TAB);
+bool AutomatedUITest::JavaScriptDebugger() {
+ return RunCommand(IDC_DEBUGGER);
}
-bool AutomatedUITest::ZoomPlus() {
- return RunCommand(IDC_ZOOM_PLUS);
-}
+bool AutomatedUITest::Navigate() {
+ scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow());
+ if (browser.get() == NULL) {
+ AddErrorAttribute("browser_window_not_found");
+ return false;
+ }
+ bool did_timeout;
+ scoped_ptr<TabProxy> tab(
+ browser->GetActiveTabWithTimeout(kWaitForActionMaxMsec, &did_timeout));
+ // TODO(devint): This might be masking a bug. I can't think of many
+ // valid cases where we would get a browser window, but not be able
+ // to return an active tab. Yet this has happened and has triggered crashes.
+ // Investigate this.
+ if (tab.get() == NULL) {
+ AddErrorAttribute("active_tab_not_found");
+ return false;
+ }
+ std::string url = "about:blank";
+ if (init_reader_.NodeAttribute("url", &url)) {
+ xml_writer_.AddAttribute("url", url);
+ }
+ GURL test_url(url);
+ did_timeout = false;
+ tab->NavigateToURLWithTimeout(test_url, kMaxTestExecutionTime, &did_timeout);
-bool AutomatedUITest::ZoomMinus() {
- return RunCommand(IDC_ZOOM_MINUS);
+ if (did_timeout) {
+ AddWarningAttribute("timeout");
+ return false;
+ }
+ return true;
}
-bool AutomatedUITest::ShowHistory() {
- return RunCommand(IDC_SHOW_HISTORY);
+bool AutomatedUITest::NewTab() {
+ scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow());
+ if (browser.get() == NULL) {
+ AddErrorAttribute("browser_window_not_found");
+ return false;
+ }
+ int old_tab_count;
+ int new_tab_count;
+ bool is_timeout;
+ browser->GetTabCountWithTimeout(&old_tab_count, kWaitForActionMaxMsec,
+ &is_timeout);
+ // Apply accelerator and wait for a new tab to open, if either
+ // fails, return false. Apply Accelerator takes care of logging its failure.
+ bool return_value = RunCommand(IDC_NEWTAB);
+ if (!browser->WaitForTabCountToChange(
+ old_tab_count, &new_tab_count, kWaitForActionMaxMsec)) {
+ AddWarningAttribute("tab_count_failed_to_change");
+ return false;
+ }
+ return return_value;
}
-bool AutomatedUITest::ShowDownloads() {
- return RunCommand(IDC_SHOW_DOWNLOADS);
+bool AutomatedUITest::OpenAboutDialog() {
+ return RunCommand(IDC_ABOUT);
}
-bool AutomatedUITest::ImportSettings() {
- return RunCommand(IDC_IMPORT_SETTINGS);
+bool AutomatedUITest::OpenClearBrowsingDataDialog() {
+ return RunCommand(IDC_CLEAR_BROWSING_DATA);
}
-bool AutomatedUITest::EditSearchEngines() {
+bool AutomatedUITest::OpenEditSearchEnginesDialog() {
return RunCommand(IDC_EDIT_SEARCH_ENGINES);
}
-bool AutomatedUITest::ViewPasswords() {
- return RunCommand(IDC_VIEW_PASSWORDS);
+bool AutomatedUITest::OpenImportSettingsDialog() {
+ return RunCommand(IDC_IMPORT_SETTINGS);
}
-bool AutomatedUITest::ClearBrowserData() {
- return RunCommand(IDC_CLEAR_BROWSING_DATA);
+bool AutomatedUITest::OpenTaskManagerDialog() {
+ return RunCommand(IDC_TASKMANAGER);
}
-bool AutomatedUITest::TaskManager() {
- return RunCommand(IDC_TASKMANAGER);
+bool AutomatedUITest::OpenViewPasswordsDialog() {
+ return RunCommand(IDC_VIEW_PASSWORDS);
}
bool AutomatedUITest::Options() {
return RunCommand(IDC_OPTIONS);
}
-bool AutomatedUITest::JavaScriptConsole() {
- return RunCommand(IDC_SHOW_JS_CONSOLE);
+bool AutomatedUITest::PressDownArrow() {
+ return SimulateKeyPressInActiveWindow(VK_DOWN, 0);
}
-bool AutomatedUITest::JavaScriptDebugger() {
- return RunCommand(IDC_DEBUGGER);
+bool AutomatedUITest::PressEnterKey() {
+ return SimulateKeyPressInActiveWindow(VK_RETURN, 0);
}
-bool AutomatedUITest::About() {
- return RunCommand(IDC_ABOUT);
+bool AutomatedUITest::PressEscapeKey() {
+ return SimulateKeyPressInActiveWindow(VK_ESCAPE, 0);
}
-bool AutomatedUITest::GoOffTheRecord() {
- return RunCommand(IDC_GOOFFTHERECORD);
+bool AutomatedUITest::PressPageDown() {
+ return SimulateKeyPressInActiveWindow(VK_PRIOR, 0);
}
-bool AutomatedUITest::PressEscapeKey() {
- return SimulateKeyPressInActiveWindow(VK_ESCAPE, 0);
+bool AutomatedUITest::PressPageUp() {
+ return SimulateKeyPressInActiveWindow(VK_NEXT, 0);
+}
+
+bool AutomatedUITest::PressSpaceBar() {
+ return SimulateKeyPressInActiveWindow(VK_SPACE, 0);
}
bool AutomatedUITest::PressTabKey() {
return SimulateKeyPressInActiveWindow(VK_TAB, 0);
}
-bool AutomatedUITest::PressEnterKey() {
- return SimulateKeyPressInActiveWindow(VK_RETURN, 0);
+bool AutomatedUITest::PressUpArrow() {
+ return SimulateKeyPressInActiveWindow(VK_UP, 0);
}
-bool AutomatedUITest::PressSpaceBar() {
- return SimulateKeyPressInActiveWindow(VK_SPACE, 0);
+bool AutomatedUITest::ReloadPage() {
+ return RunCommand(IDC_RELOAD);
}
-bool AutomatedUITest::PageDown() {
- return SimulateKeyPressInActiveWindow(VK_PRIOR, 0);
+bool AutomatedUITest::SelectNextTab() {
+ return RunCommand(IDC_SELECT_NEXT_TAB);
}
+bool AutomatedUITest::SelectPreviousTab() {
+ return RunCommand(IDC_SELECT_PREV_TAB);
+}
-bool AutomatedUITest::PageUp() {
- return SimulateKeyPressInActiveWindow(VK_NEXT, 0);
+bool AutomatedUITest::ShowDownloads() {
+ return RunCommand(IDC_SHOW_DOWNLOADS);
}
-bool AutomatedUITest::UpArrow() {
- return SimulateKeyPressInActiveWindow(VK_UP, 0);
+bool AutomatedUITest::ShowHistory() {
+ return RunCommand(IDC_SHOW_HISTORY);
}
-bool AutomatedUITest::DownArrow() {
- return SimulateKeyPressInActiveWindow(VK_DOWN, 0);
+bool AutomatedUITest::StarPage() {
+ return RunCommand(IDC_STAR);
+}
+
+bool AutomatedUITest::ZoomMinus() {
+ return RunCommand(IDC_ZOOM_MINUS);
+}
+
+bool AutomatedUITest::ZoomPlus() {
+ return RunCommand(IDC_ZOOM_PLUS);
}
bool AutomatedUITest::TestEditKeywords() {
DoAction("EditKeywords");
- return TestDialog(kTestDialogActionsToRun);
+ return FuzzyTestDialog(kTestDialogActionsToRun);
}
bool AutomatedUITest::TestTaskManager() {
DoAction("TaskManager");
- return TestDialog(kTestDialogActionsToRun);
+ return FuzzyTestDialog(kTestDialogActionsToRun);
}
bool AutomatedUITest::TestOptions() {
DoAction("Options");
- return TestDialog(kTestDialogActionsToRun);
+ return FuzzyTestDialog(kTestDialogActionsToRun);
}
bool AutomatedUITest::TestViewPasswords() {
DoAction("ViewPasswords");
- return TestDialog(kTestDialogActionsToRun);
+ return FuzzyTestDialog(kTestDialogActionsToRun);
}
-bool AutomatedUITest::TestClearBrowserData() {
+bool AutomatedUITest::TestClearBrowsingData() {
DoAction("ClearBrowserData");
- return TestDialog(kTestDialogActionsToRun);
+ return FuzzyTestDialog(kTestDialogActionsToRun);
}
bool AutomatedUITest::TestImportSettings() {
DoAction("ImportSettings");
- return TestDialog(kTestDialogActionsToRun);
+ return FuzzyTestDialog(kTestDialogActionsToRun);
}
bool AutomatedUITest::ExerciseDialog() {
int index = rand_util::RandInt(0, arraysize(kDialogs) - 1);
- return DoAction(kDialogs[index]) && TestDialog(kTestDialogActionsToRun);
+ return DoAction(kDialogs[index]) && FuzzyTestDialog(kTestDialogActionsToRun);
}
-bool AutomatedUITest::TestDialog(int num_actions) {
+bool AutomatedUITest::FuzzyTestDialog(int num_actions) {
bool return_value = true;
for (int i = 0; i < num_actions; i++) {
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.h b/chrome/test/automated_ui_tests/automated_ui_tests.h
index 9917b83..307cba1 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.h
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.h
@@ -27,8 +27,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TESTS_H__
-#define CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TESTS_H__
+#ifndef CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TESTS_H_
+#define CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TESTS_H_
// This takes an input file of commands, which consist of a series of
// actions, and runs every command, reporting the status of each one
@@ -147,104 +147,95 @@ class AutomatedUITest : public UITest {
// Actions ------------------------------------------------------------------
- // Navigates the activate tab to about:blank.
- // XML element: <Navigate/>
- // Optional Attributes: url="|address|" will navigate to |address|
- bool Navigate();
-
- // Opens a new tab in the active window using an accelerator.
- // Returns true if call to activate the accelerator is successful.
- // XML element: <NewTab/>
- bool NewTab();
+ // NOTE: This list is sorted alphabetically, so that we can easily detect
+ // missing actions.
// Activates back button in active window.
// Returns true if call to activate the accelerator is successful.
// XML element: <Back/>
bool BackButton();
- // Activates forward button in active window.
- // Returns true if call to activate the accelerator is successful.
- // XML element: <Forward/>
- bool ForwardButton();
-
// Uses accelerator to close the active tab if it isn't the only tab.
// Returns false if active tab is the only tab, true otherwise.
// XML element: <CloseTab/>
bool CloseActiveTab();
- // Opens a new browser window by calling automation()->OpenNewBrowserWindow
- // Then activates the tab opened in the new window.
- // Returns true if window is successfully created.
- // XML element: <OpenWindow/>
- bool OpenAndActivateNewBrowserWindow();
-
- // Reload the active tab. Returns false on failure.
- // XML element: <Reload/>
- bool ReloadPage();
-
- // Stars the current page. This opens a dialog that may or may not be
- // dismissed.
- // XML element: <Star/>
- bool StarPage();
+ // Opens one of the dialogs (chosen randomly) and exercises it.
+ // XML element: <Dialog/>
+ bool ExerciseDialog();
// Activates "find in page" on the current page.
// XML element: <FindInPage/>
bool FindInPage();
- // Activates the next tab on the active browser window.
- // XML element: <SelectNextTab/>
- bool SelectNextTab();
+ // Activates forward button in active window.
+ // Returns true if call to activate the accelerator is successful.
+ // XML element: <Forward/>
+ bool ForwardButton();
- // Activates the previous tab on the active browser window.
- // XML element: <SelectPrevTab/>
- bool SelectPreviousTab();
+ // Opens and focuses an OffTheRecord browser window.
+ // XML element: <GoOffTheRecord/>
+ bool GoOffTheRecord();
- // Increases the text size on the current active tab.
- // XML element: <ZoomPlus/>
- bool ZoomPlus();
+ // 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.
+ // XML element: <JavaScriptConsole/>
+ bool JavaScriptConsole();
- // Decreases the text size on the current active tab.
- // XML element: <ZoomMinus/>
- bool ZoomMinus();
+ // Opens the JavaScriptDebugger 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.
+ // XML element: <JavaScriptDebugger/>
+ bool JavaScriptDebugger();
- // Opens the History page in the current active browser window.
- // XML element: <History/>
- bool ShowHistory();
+ // Navigates the activate tab to about:blank.
+ // XML element: <Navigate/>
+ // Optional Attributes: url="|address|" will navigate to |address|
+ bool Navigate();
- // Opens the Downloads page in the current active browser window.
- // XML element: <Downloads/>
- bool ShowDownloads();
+ // Opens a new tab in the active window using an accelerator.
+ // Returns true if call to activate the accelerator is successful.
+ // XML element: <NewTab/>
+ bool NewTab();
- // Opens the Import Settings dialog, this dialog is modal so a majority of
+ // Opens a new browser window by calling automation()->OpenNewBrowserWindow
+ // Then activates the tab opened in the new window.
+ // Returns true if window is successfully created.
+ // XML element: <OpenWindow/>
+ bool OpenAndActivateNewBrowserWindow();
+
+ // Opens the About dialog. This dialog is modal so a majority of the test
+ // can't be completed until it is dismissed.
+ // XML element: <About/>
+ bool OpenAboutDialog();
+
+ // Opens the Clear Browsing Data dialog, this dialog is modal so a majority of
// the test can't be completed until it is dismissed.
- // XML element: <ImportSettings/>
- bool ImportSettings();
+ // XML element: <ClearBrowserData/>
+ bool OpenClearBrowsingDataDialog();
// Opens the Search Engines dialog. 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.
// XML element: <EditSearchEngines/>
- bool EditSearchEngines();
+ bool OpenEditSearchEnginesDialog();
- // Opens one of the dialogs (chosen randomly) and exercises it.
- // XML element: <Dialog/>
- bool ExerciseDialog();
-
- // Opens the View Passwords dialog, this dialog is modal so a majority of
- // the test can't be completed until it is dismissed.
- // XML element: <ViewPasswords/>
- bool ViewPasswords();
-
- // Opens the Clear Browser Data dialog, this dialog is modal so a majority of
+ // Opens the Import Settings dialog, this dialog is modal so a majority of
// the test can't be completed until it is dismissed.
- // XML element: <ClearBrowserData/>
- bool ClearBrowserData();
+ // XML element: <ImportSettings/>
+ bool OpenImportSettingsDialog();
// Opens the Task Manager dialog. 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.
// XML element: <TaskManager/>
- bool TaskManager();
+ bool OpenTaskManagerDialog();
+
+ // Opens the View Passwords dialog, this dialog is modal so a majority of
+ // the test can't be completed until it is dismissed.
+ // XML element: <ViewPasswords/>
+ bool OpenViewPasswordsDialog();
// Opens the Options dialog. While it isn't modal, it takes focus from
// the current browser window, so most of the test can't continue until it is
@@ -252,58 +243,70 @@ class AutomatedUITest : public UITest {
// XML element: <Options/>
bool Options();
- // Opens the About dialog. This dialog is modal so a majority of the test
- // can't be completed until it is dismissed.
- // XML element: <About/>
- bool About();
-
- // Opens the JavaScriptDebugger 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.
- // XML element: <JavaScriptDebugger/>
- bool JavaScriptDebugger();
-
- // 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.
- // XML element: <JavaScriptConsole/>
- bool JavaScriptConsole();
+ // Simulates a page up key press on the active window.
+ // XML element: <DownArrow/>
+ bool PressDownArrow();
- // Opens and focuses an OffTheRecord browser window.
- // XML element: <GoOffTheRecord/>
- bool GoOffTheRecord();
+ // Simulates an enter key press on the active window.
+ // XML element: <PressEnterKey/>
+ bool PressEnterKey();
// Simulates an escape key press on the active window.
// XML element: <PressEscapeKey/>
bool PressEscapeKey();
- // Simulates a tab key press on the active window.
- // XML element: <PressTabKey/>
- bool PressTabKey();
+ // Simulates a page down key press on the active window.
+ // XML element: <PageDown/>
+ bool PressPageDown();
- // Simulates an enter key press on the active window.
- // XML element: <PressEnterKey/>
- bool PressEnterKey();
+ // Simulates a page up key press on the active window.
+ // XML element: <PageUp/>
+ bool PressPageUp();
// Simulates a space bar press on the active window.
// XML element: <PressSpaceBar/>
bool PressSpaceBar();
- // Simulates a page down key press on the active window.
- // XML element: <PageDown/>
- bool PageDown();
-
- // Simulates a page up key press on the active window.
- // XML element: <PageUp/>
- bool PageUp();
+ // Simulates a tab key press on the active window.
+ // XML element: <PressTabKey/>
+ bool PressTabKey();
// Simulates a page up key press on the active window.
// XML element: <UpArrow/>
- bool UpArrow();
+ bool PressUpArrow();
- // Simulates a page up key press on the active window.
- // XML element: <DownArrow/>
- bool DownArrow();
+ // Reload the active tab. Returns false on failure.
+ // XML element: <Reload/>
+ bool ReloadPage();
+
+ // 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();
+
+ // 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/>
+ bool StarPage();
+
+ // Decreases the text size on the current active tab.
+ // XML element: <ZoomMinus/>
+ bool ZoomMinus();
+
+ // Increases the text size on the current active tab.
+ // XML element: <ZoomPlus/>
+ bool ZoomPlus();
// Test Dialog Actions ******************************************************
// These are a special set of actions that perform multiple actions on a
@@ -317,10 +320,22 @@ class AutomatedUITest : public UITest {
// <TestEditKeywords> <PressTabKey/><PressEnterKey/><DownArrow/>
// <DownArrow/><PressEscapeKey/> </TestEditKeywords>
+ // Opens Clear Browsing Data dialog and runs random actions on it.
+ // XML element: <TestClearBrowserData/>
+ bool TestClearBrowsingData();
+
// Opens Edit Keywords dialog and runs random actions on it.
// XML element: <TestEditKeywords/>
bool TestEditKeywords();
+ // Opens Import Settings dialog and runs random actions on it.
+ // XML element: <TestImportSettings/>
+ bool TestImportSettings();
+
+ // Opens Options dialog and runs random actions on it.
+ // XML element: <TestOptions/>
+ bool TestOptions();
+
// Opens Task Manager and runs random actions on it.
// This has the possibility of killing both the browser and renderer
// processes, which will cause non-fatal errors for the remaining actions
@@ -328,27 +343,15 @@ class AutomatedUITest : public UITest {
// XML element: <TestTaskManager/>
bool TestTaskManager();
- // Opens Options dialog and runs random actions on it.
- // XML element: <TestOptions/>
- bool TestOptions();
-
// Opens View Passwords dialog and runs random actions on it.
// XML element: <TestViewPasswords/>
bool TestViewPasswords();
- // Opens Clear Browser Data dialog and runs random actions on it.
- // XML element: <TestClearBrowserData/>
- bool TestClearBrowserData();
-
- // Opens Import Settings dialog and runs random actions on it.
- // XML element: <TestImportSettings/>
- bool TestImportSettings();
-
// End Test Dialog Actions **************************************************
// Runs a limited set of actions designed to test dialogs. Will run
// |num_actions| from the set defined in test_dialog_possible_actions_.
- bool TestDialog(int num_actions);
+ bool FuzzyTestDialog(int num_actions);
// Navigates to about:crash.
// XML element: <Crash/>
@@ -480,4 +483,4 @@ class AutomatedUITest : public UITest {
DISALLOW_EVIL_CONSTRUCTORS(AutomatedUITest);
};
-#endif // #define CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TESTS_H__
+#endif // CHROME_TEST_AUTOMATED_UI_TESTS_AUTOMATED_UI_TESTS_H_