summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_provider.cc38
-rw-r--r--chrome/browser/automation/automation_provider.h8
-rw-r--r--chrome/browser/automation/automation_provider_aura.cc8
-rw-r--r--chrome/browser/automation/automation_provider_gtk.cc63
-rw-r--r--chrome/browser/automation/automation_provider_mac.mm12
-rw-r--r--chrome/browser/automation/automation_provider_win.cc149
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc91
-rw-r--r--chrome/browser/automation/testing_automation_provider.h23
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/common/automation_messages_internal.h14
-rw-r--r--chrome/test/automation/browser_proxy.cc21
-rw-r--r--chrome/test/automation/browser_proxy.h8
-rw-r--r--chrome/test/automation/tab_proxy.cc4
-rw-r--r--chrome/test/automation/tab_proxy.h4
-rw-r--r--chrome/test/automation/window_proxy.cc14
-rw-r--r--chrome/test/automation/window_proxy.h14
-rw-r--r--chrome/test/reliability/automated_ui_test_base.cc140
-rw-r--r--chrome/test/reliability/automated_ui_test_base.h15
-rw-r--r--chrome/test/reliability/automated_ui_test_interactive_test.cc70
-rw-r--r--chrome/test/reliability/automated_ui_tests.cc37
-rw-r--r--chrome/test/reliability/automated_ui_tests.h6
-rw-r--r--chrome/test/reliability/page_load_test.cc23
22 files changed, 76 insertions, 687 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 364ac75..faa6d2b 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -67,6 +67,7 @@
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_item.h"
+#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/trace_controller.h"
#include "content/public/browser/web_contents.h"
@@ -362,10 +363,6 @@ bool AutomationProvider::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
bool deserialize_success = true;
IPC_BEGIN_MESSAGE_MAP_EX(AutomationProvider, message, deserialize_success)
-#if !defined(OS_MACOSX)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowDrag,
- WindowSimulateDrag)
-#endif // !defined(OS_MACOSX)
IPC_MESSAGE_HANDLER(AutomationMsg_HandleUnused, HandleUnused)
IPC_MESSAGE_HANDLER(AutomationMsg_SetProxyConfig, SetProxyConfig)
IPC_MESSAGE_HANDLER(AutomationMsg_PrintAsync, PrintAsync)
@@ -375,6 +372,7 @@ bool AutomationProvider::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AutomationMsg_Cut, Cut)
IPC_MESSAGE_HANDLER(AutomationMsg_Copy, Copy)
IPC_MESSAGE_HANDLER(AutomationMsg_Paste, Paste)
+ IPC_MESSAGE_HANDLER(AutomationMsg_KeyPress, KeyPress)
IPC_MESSAGE_HANDLER(AutomationMsg_ReloadAsync, ReloadAsync)
IPC_MESSAGE_HANDLER(AutomationMsg_StopAsync, StopAsync)
IPC_MESSAGE_HANDLER(AutomationMsg_SetPageFontSize, OnSetPageFontSize)
@@ -623,6 +621,38 @@ void AutomationProvider::Paste(int tab_handle) {
view->Paste();
}
+
+
+void AutomationProvider::KeyPress(int tab_handle, int key) {
+ RenderViewHost* view = GetViewForTab(tab_handle);
+ if (!view) {
+ NOTREACHED();
+ return;
+ }
+
+ content::NativeWebKeyboardEvent event;
+ event.nativeKeyCode = 0;
+ event.windowsKeyCode = key;
+ event.setKeyIdentifierFromWindowsKeyCode();
+ event.modifiers = 0;
+ event.isSystemKey = false;
+ event.timeStampSeconds = base::Time::Now().ToDoubleT();
+ event.skip_in_browser = true;
+
+ event.text[0] = key;
+ event.unmodifiedText[0] = key;
+ event.type = WebKit::WebInputEvent::RawKeyDown;
+ view->ForwardKeyboardEvent(event);
+
+ event.type = WebKit::WebInputEvent::Char;
+ view->ForwardKeyboardEvent(event);
+
+ event.type = WebKit::WebInputEvent::KeyUp;
+ event.text[0] = 0;
+ event.unmodifiedText[0] = 0;
+ view->ForwardKeyboardEvent(event);
+}
+
void AutomationProvider::ReloadAsync(int tab_handle) {
if (tab_tracker_->ContainsHandle(tab_handle)) {
NavigationController* tab = tab_tracker_->GetResource(tab_handle);
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index aa03918..657dc3a 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -235,12 +235,6 @@ class AutomationProvider
// Clear and reinitialize the automation IPC channel.
bool ReinitializeChannel();
- // IPC Message callbacks.
- void WindowSimulateDrag(int handle,
- const std::vector<gfx::Point>& drag_path,
- int flags,
- bool press_escape_en_route,
- IPC::Message* reply_message);
void HandleUnused(const IPC::Message& message, int handle);
void GetFilteredInetHitCount(int* hit_count);
void SetProxyConfig(const std::string& new_proxy_config);
@@ -283,6 +277,8 @@ class AutomationProvider
void Copy(int tab_handle);
void Paste(int tab_handle);
+ void KeyPress(int tab_handle, int key);
+
void ReloadAsync(int tab_handle);
void StopAsync(int tab_handle);
void SaveAsAsync(int tab_handle);
diff --git a/chrome/browser/automation/automation_provider_aura.cc b/chrome/browser/automation/automation_provider_aura.cc
index 5d54047..5082f43 100644
--- a/chrome/browser/automation/automation_provider_aura.cc
+++ b/chrome/browser/automation/automation_provider_aura.cc
@@ -4,14 +4,6 @@
#include "chrome/browser/automation/automation_provider.h"
-void AutomationProvider::WindowSimulateDrag(
- int handle,
- const std::vector<gfx::Point>& drag_path,
- int flags,
- bool press_escape_en_route,
- IPC::Message* reply_message) {
-}
-
void AutomationProvider::PrintAsync(int tab_handle) {
}
diff --git a/chrome/browser/automation/automation_provider_gtk.cc b/chrome/browser/automation/automation_provider_gtk.cc
index c8e3188..111d1aa 100644
--- a/chrome/browser/automation/automation_provider_gtk.cc
+++ b/chrome/browser/automation/automation_provider_gtk.cc
@@ -17,70 +17,7 @@
#include "chrome/common/automation_messages.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
-#include "ui/ui_controls/ui_controls.h"
-
-namespace {
-
-// This function sends a WindowDragResponse message with the appropriate routing
-// ID to the automation proxy.
-void SendWindowDragResponse(AutomationProvider* provider,
- IPC::Message* reply_message) {
- AutomationMsg_WindowDrag::WriteReplyParams(reply_message, true);
- provider->Send(reply_message);
-}
-
-} // namespace
void AutomationProvider::PrintAsync(int tab_handle) {
NOTIMPLEMENTED();
}
-
-void AutomationProvider::WindowSimulateDrag(
- int handle,
- const std::vector<gfx::Point>& drag_path,
- int flags,
- bool press_escape_en_route,
- IPC::Message* reply_message) {
- // TODO(estade): don't ignore |flags| or |escape_en_route|.
- gfx::NativeWindow window =
- browser_tracker_->GetResource(handle)->window()->GetNativeWindow();
- if (window && (drag_path.size() > 1)) {
- int x, y;
- gdk_window_get_position(gtk_widget_get_window(GTK_WIDGET(window)), &x, &y);
-
- // Create a nested stack of tasks to run.
- base::Closure drag_response_cb = base::Bind(
- &SendWindowDragResponse, make_scoped_refptr(this), reply_message);
- base::Closure move_chain_cb = base::Bind(
- base::IgnoreResult(&ui_controls::SendMouseEventsNotifyWhenDone),
- ui_controls::LEFT, ui_controls::UP, drag_response_cb);
- move_chain_cb = base::Bind(
- base::IgnoreResult(&ui_controls::SendMouseEventsNotifyWhenDone),
- ui_controls::LEFT, ui_controls::UP, move_chain_cb);
- for (size_t i = drag_path.size() - 1; i > 0; --i) {
- // Smooth out the mouse movements by adding intermediate points. This
- // better simulates a real user drag.
- int dest_x = drag_path[i].x() + x;
- int dest_y = drag_path[i].y() + y;
- int half_step_x = (dest_x + drag_path[i - 1].x() + x) / 2;
- int half_step_y = (dest_y + drag_path[i - 1].y() + y) / 2;
-
- move_chain_cb = base::Bind(
- base::IgnoreResult(&ui_controls::SendMouseMoveNotifyWhenDone),
- dest_x, dest_y, move_chain_cb);
- move_chain_cb = base::Bind(
- base::IgnoreResult(&ui_controls::SendMouseMoveNotifyWhenDone),
- half_step_x, half_step_y, move_chain_cb);
- }
- move_chain_cb = base::Bind(
- base::IgnoreResult(&ui_controls::SendMouseEventsNotifyWhenDone),
- ui_controls::LEFT, ui_controls::DOWN, move_chain_cb);
-
- ui_controls::SendMouseMoveNotifyWhenDone(x + drag_path[0].x(),
- y + drag_path[0].y(),
- move_chain_cb);
- } else {
- AutomationMsg_WindowDrag::WriteReplyParams(reply_message, false);
- Send(reply_message);
- }
-}
diff --git a/chrome/browser/automation/automation_provider_mac.mm b/chrome/browser/automation/automation_provider_mac.mm
index 703e0b3..4a7ecab 100644
--- a/chrome/browser/automation/automation_provider_mac.mm
+++ b/chrome/browser/automation/automation_provider_mac.mm
@@ -22,15 +22,3 @@
void AutomationProvider::PrintAsync(int tab_handle) {
NOTIMPLEMENTED();
}
-
-void AutomationProvider::WindowSimulateDrag(
- int handle,
- const std::vector<gfx::Point>& drag_path,
- int flags,
- bool press_escape_en_route,
- IPC::Message* reply_message) {
- NOTIMPLEMENTED();
- AutomationMsg_WindowDrag::WriteReplyParams(reply_message, false);
- Send(reply_message);
-}
-
diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc
index 94ca5357..eaed51e 100644
--- a/chrome/browser/automation/automation_provider_win.cc
+++ b/chrome/browser/automation/automation_provider_win.cc
@@ -26,7 +26,6 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/page_zoom.h"
#include "ui/base/keycodes/keyboard_codes.h"
-#include "ui/ui_controls/ui_controls.h"
#include "ui/views/focus/accelerator_handler.h"
#include "ui/views/widget/root_view.h"
@@ -34,154 +33,6 @@ using content::NavigationController;
using content::RenderViewHost;
using content::WebContents;
-namespace {
-
-// Allow some pending tasks up to |num_deferrals| generations to complete.
-void DeferredQuitRunLoop(const base::Closure& quit_task,
- int num_quit_deferrals) {
- if (num_quit_deferrals <= 0) {
- quit_task.Run();
- } else {
- MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&DeferredQuitRunLoop, quit_task, num_quit_deferrals - 1));
- }
-}
-
-// This callback just adds another callback to the event queue. This is useful
-// if you want to ensure that any callbacks added to the event queue after this
-// one have already been processed by the time |callback| is run.
-void InvokeCallbackLater(const base::Closure& callback) {
- MessageLoop::current()->PostTask(FROM_HERE, callback);
-}
-
-void MoveMouse(const POINT& point) {
- SetCursorPos(point.x, point.y);
-
- // Now, make sure that GetMessagePos returns the values we just set by
- // simulating a mouse move. The value returned by GetMessagePos is updated
- // when a mouse move event is removed from the event queue.
- PostMessage(NULL, WM_MOUSEMOVE, 0, MAKELPARAM(point.x, point.y));
- MSG msg;
- while (PeekMessage(&msg, NULL, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE)) {
- }
-
- // Verify
-#ifndef NDEBUG
- DWORD pos = GetMessagePos();
- gfx::Point cursor_point(pos);
- DCHECK_EQ(point.x, cursor_point.x());
- DCHECK_EQ(point.y, cursor_point.y());
-#endif
-}
-
-BOOL CALLBACK EnumThreadWndProc(HWND hwnd, LPARAM l_param) {
- if (hwnd == reinterpret_cast<HWND>(l_param)) {
- return FALSE;
- }
- return TRUE;
-}
-
-// This callback sends a WindowDragResponse message with the appropriate routing
-// ID to the automation proxy. This is implemented as a task so that we know
-// that the mouse events (and any tasks that they spawn on the message loop)
-// have been processed by the time this is sent.
-void WindowDragResponseCallback(AutomationProvider* provider,
- IPC::Message* reply_message) {
- DCHECK(reply_message != NULL);
- AutomationMsg_WindowDrag::WriteReplyParams(reply_message, true);
- provider->Send(reply_message);
-}
-
-} // namespace
-
-void AutomationProvider::WindowSimulateDrag(
- int handle,
- const std::vector<gfx::Point>& drag_path,
- int flags,
- bool press_escape_en_route,
- IPC::Message* reply_message) {
- if (browser_tracker_->ContainsHandle(handle) && (drag_path.size() > 1)) {
- gfx::NativeWindow window =
- browser_tracker_->GetResource(handle)->window()->GetNativeWindow();
-
- UINT down_message = 0;
- UINT up_message = 0;
- WPARAM wparam_flags = 0;
- if (flags & ui::EF_SHIFT_DOWN)
- wparam_flags |= MK_SHIFT;
- if (flags & ui::EF_CONTROL_DOWN)
- wparam_flags |= MK_CONTROL;
- if (flags & ui::EF_LEFT_MOUSE_BUTTON) {
- wparam_flags |= MK_LBUTTON;
- down_message = WM_LBUTTONDOWN;
- up_message = WM_LBUTTONUP;
- }
- if (flags & ui::EF_MIDDLE_MOUSE_BUTTON) {
- wparam_flags |= MK_MBUTTON;
- down_message = WM_MBUTTONDOWN;
- up_message = WM_MBUTTONUP;
- }
- if (flags & ui::EF_RIGHT_MOUSE_BUTTON) {
- wparam_flags |= MK_RBUTTON;
- down_message = WM_LBUTTONDOWN;
- up_message = WM_LBUTTONUP;
- }
-
- Browser* browser = browser_tracker_->GetResource(handle);
- DCHECK(browser);
- HWND top_level_hwnd =
- reinterpret_cast<HWND>(browser->window()->GetNativeWindow());
- POINT temp = drag_path[0].ToPOINT();
- MapWindowPoints(top_level_hwnd, HWND_DESKTOP, &temp, 1);
- MoveMouse(temp);
- SendMessage(top_level_hwnd, down_message, wparam_flags,
- MAKELPARAM(drag_path[0].x(), drag_path[0].y()));
- for (int i = 1; i < static_cast<int>(drag_path.size()); ++i) {
- temp = drag_path[i].ToPOINT();
- MapWindowPoints(top_level_hwnd, HWND_DESKTOP, &temp, 1);
- MoveMouse(temp);
- SendMessage(top_level_hwnd, WM_MOUSEMOVE, wparam_flags,
- MAKELPARAM(drag_path[i].x(), drag_path[i].y()));
- }
- POINT end = drag_path[drag_path.size() - 1].ToPOINT();
- MapWindowPoints(top_level_hwnd, HWND_DESKTOP, &end, 1);
- MoveMouse(end);
-
- if (press_escape_en_route) {
- // Press Escape, making sure we wait until chrome processes the escape.
- // TODO(phajdan.jr): make this use ui_test_utils::SendKeyPressSync.
- views::AcceleratorHandler handler;
- base::RunLoop run_loop(&handler);
- // Number of times to repost Quit task to allow pending tasks to complete.
- // See kNumQuitDeferrals in ui_test_utils.cc for explanation.
- int num_quit_deferrals = 10;
- ui_controls::SendKeyPressNotifyWhenDone(
- window, ui::VKEY_ESCAPE,
- ((flags & ui::EF_CONTROL_DOWN) ==
- ui::EF_CONTROL_DOWN),
- ((flags & ui::EF_SHIFT_DOWN) ==
- ui::EF_SHIFT_DOWN),
- ((flags & ui::EF_ALT_DOWN) == ui::EF_ALT_DOWN),
- false,
- base::Bind(&DeferredQuitRunLoop, run_loop.QuitClosure(),
- num_quit_deferrals));
- MessageLoopForUI* loop = MessageLoopForUI::current();
- MessageLoop::ScopedNestableTaskAllower allow(loop);
- run_loop.Run();
- }
- SendMessage(top_level_hwnd, up_message, wparam_flags,
- MAKELPARAM(end.x, end.y));
-
- MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(
- &InvokeCallbackLater,
- base::Bind(&WindowDragResponseCallback, this, reply_message)));
- } else {
- AutomationMsg_WindowDrag::WriteReplyParams(reply_message, false);
- Send(reply_message);
- }
-}
-
void AutomationProvider::CreateExternalTab(
const ExternalTabSettings& settings,
gfx::NativeWindow* tab_container_window, gfx::NativeWindow* tab_window,
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index be7ebf4..12ec70f 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -147,7 +147,6 @@
#include "ui/base/events/event_constants.h"
#include "ui/base/keycodes/keyboard_codes.h"
#include "ui/base/ui_base_types.h"
-#include "ui/ui_controls/ui_controls.h"
#include "webkit/glue/webdropdata.h"
#include "webkit/plugins/webplugininfo.h"
@@ -376,8 +375,6 @@ bool TestingAutomationProvider::OnMessageReceived(
IPC_MESSAGE_HANDLER(AutomationMsg_TerminateSession, TerminateSession)
IPC_MESSAGE_HANDLER(AutomationMsg_WindowViewBounds, WindowGetViewBounds)
IPC_MESSAGE_HANDLER(AutomationMsg_SetWindowBounds, SetWindowBounds)
- IPC_MESSAGE_HANDLER(AutomationMsg_WindowMouseMove, WindowSimulateMouseMove)
- IPC_MESSAGE_HANDLER(AutomationMsg_WindowKeyPress, WindowSimulateKeyPress)
IPC_MESSAGE_HANDLER(AutomationMsg_TabCount, GetTabCount)
IPC_MESSAGE_HANDLER(AutomationMsg_Type, GetType)
IPC_MESSAGE_HANDLER(AutomationMsg_Tab, GetTab)
@@ -672,35 +669,6 @@ void TestingAutomationProvider::ExecuteBrowserCommand(
Send(reply_message);
}
-void TestingAutomationProvider::WindowSimulateMouseMove(
- const IPC::Message& message,
- int handle,
- const gfx::Point& location) {
- if (window_tracker_->ContainsHandle(handle))
- ui_controls::SendMouseMove(location.x(), location.y());
-}
-
-void TestingAutomationProvider::WindowSimulateKeyPress(
- const IPC::Message& message,
- int handle,
- int key,
- int flags) {
- if (!window_tracker_->ContainsHandle(handle))
- return;
-
- gfx::NativeWindow window = window_tracker_->GetResource(handle);
- // The key event is sent to whatever window is active.
- ui_controls::SendKeyPress(window, static_cast<ui::KeyboardCode>(key),
- ((flags & ui::EF_CONTROL_DOWN) ==
- ui::EF_CONTROL_DOWN),
- ((flags & ui::EF_SHIFT_DOWN) ==
- ui::EF_SHIFT_DOWN),
- ((flags & ui::EF_ALT_DOWN) ==
- ui::EF_ALT_DOWN),
- ((flags & ui::EF_COMMAND_DOWN) ==
- ui::EF_COMMAND_DOWN));
-}
-
void TestingAutomationProvider::WebkitMouseClick(DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
@@ -1712,8 +1680,6 @@ void TestingAutomationProvider::BuildJSONHandlerMaps() {
&TestingAutomationProvider::DragAndDropFilePaths;
handler_map_["SendWebkitKeyEvent"] =
&TestingAutomationProvider::SendWebkitKeyEvent;
- handler_map_["SendOSLevelKeyEventToTab"] =
- &TestingAutomationProvider::SendOSLevelKeyEventToTab;
handler_map_["ProcessWebMouseEvent"] =
&TestingAutomationProvider::ProcessWebMouseEvent;
handler_map_["ActivateTab"] =
@@ -4699,63 +4665,6 @@ void TestingAutomationProvider::SendWebkitKeyEvent(
view->ForwardKeyboardEvent(event);
}
-void TestingAutomationProvider::SendOSLevelKeyEventToTab(
- DictionaryValue* args,
- IPC::Message* reply_message) {
- if (SendErrorIfModalDialogActive(this, reply_message))
- return;
-
- int modifiers, keycode;
- if (!args->GetInteger("keyCode", &keycode)) {
- AutomationJSONReply(this, reply_message)
- .SendError("'keyCode' missing or invalid.");
- return;
- }
- if (!args->GetInteger("modifiers", &modifiers)) {
- AutomationJSONReply(this, reply_message)
- .SendError("'modifiers' missing or invalid.");
- return;
- }
-
- std::string error;
- Browser* browser;
- WebContents* web_contents;
- if (!GetBrowserAndTabFromJSONArgs(args, &browser, &web_contents, &error)) {
- AutomationJSONReply(this, reply_message).SendError(error);
- return;
- }
- // The key events will be sent to the browser window, we need the current tab
- // containing the element we send the text in to be shown.
- TabStripModel* tab_strip = browser->tab_strip_model();
- tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(web_contents),
- true);
-
- BrowserWindow* browser_window = browser->window();
- if (!browser_window) {
- AutomationJSONReply(this, reply_message)
- .SendError("Could not get the browser window");
- return;
- }
- gfx::NativeWindow window = browser_window->GetNativeWindow();
- if (!window) {
- AutomationJSONReply(this, reply_message)
- .SendError("Could not get the browser window handle");
- return;
- }
-
- bool control = !!(modifiers & automation::kControlKeyMask);
- bool shift = !!(modifiers & automation::kShiftKeyMask);
- bool alt = !!(modifiers & automation::kAltKeyMask);
- bool meta = !!(modifiers & automation::kMetaKeyMask);
- if (!ui_controls::SendKeyPressNotifyWhenDone(
- window, static_cast<ui::KeyboardCode>(keycode),
- control, shift, alt, meta,
- base::Bind(SendSuccessReply, AsWeakPtr(), reply_message))) {
- AutomationJSONReply(this, reply_message)
- .SendError("Could not send the native key event");
- }
-}
-
namespace {
bool ReadScriptEvaluationRequestList(
diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h
index ca5340c..6035e01 100644
--- a/chrome/browser/automation/testing_automation_provider.h
+++ b/chrome/browser/automation/testing_automation_provider.h
@@ -120,13 +120,6 @@ class TestingAutomationProvider : public AutomationProvider,
bool* success, gfx::Rect* bounds);
void SetWindowBounds(int handle, const gfx::Rect& bounds, bool* result);
void SetWindowVisible(int handle, bool visible, bool* result);
- void WindowSimulateMouseMove(const IPC::Message& message,
- int handle,
- const gfx::Point& location);
- void WindowSimulateKeyPress(const IPC::Message& message,
- int handle,
- int key,
- int flags);
void GetTabCount(int handle, int* tab_count);
void GetType(int handle, int* type_as_int);
void GetTab(int win_handle, int tab_index, int* tab_handle);
@@ -1225,22 +1218,6 @@ class TestingAutomationProvider : public AutomationProvider,
void SendWebkitKeyEvent(base::DictionaryValue* args,
IPC::Message* message);
- // Sends the key event from the OS level to the browser window,
- // allowing it to be preprocessed by some external application (ie. IME).
- // Will switch to the tab specified by tab_index before sending the event.
- // The pair |windex| and |tab_index| or the single |auto_id| must be given
- // to specify the tab.
- // Example:
- // input: { "windex": 1,
- // "tab_index": 1,
- // "auto_id": { "type": 0, "id": "awoein" },
- // "keyCode": ui::VKEY_X,
- // "modifiers": automation::kShiftKeyMask,
- // }
- // output: none
- void SendOSLevelKeyEventToTab(base::DictionaryValue* args,
- IPC::Message* message);
-
// Processes the WebKit mouse event with the specified properties.
// The pair |windex| and |tab_index| or the single |auto_id| must be given
// to specify the render view.
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 38a461d4..3bca828 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -95,7 +95,6 @@
'..',
],
'sources': [
- 'test/reliability/automated_ui_test_interactive_test.cc',
'test/reliability/automated_ui_tests.cc',
'test/reliability/automated_ui_tests.h',
],
diff --git a/chrome/common/automation_messages_internal.h b/chrome/common/automation_messages_internal.h
index 268b3c1..64a17a4 100644
--- a/chrome/common/automation_messages_internal.h
+++ b/chrome/common/automation_messages_internal.h
@@ -200,7 +200,7 @@ IPC_SYNC_MESSAGE_CONTROL2_1(AutomationMsg_SetWindowBounds,
// defined in chrome/views/event.h
// Response:
// bool - true if the drag could be performed
-IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_WindowDrag,
+IPC_SYNC_MESSAGE_CONTROL4_1(AutomationMsg_DEPRECATED_WindowDrag,
int,
std::vector<gfx::Point>,
int,
@@ -247,7 +247,7 @@ IPC_SYNC_MESSAGE_CONTROL1_2(AutomationMsg_WindowForBrowser,
// int - the ui::KeyboardCode of the key that was pressed.
// int - the flags which identify the modifiers (shift, ctrl, alt)
// associated for, as defined in chrome/views/event.h
-IPC_MESSAGE_CONTROL3(AutomationMsg_WindowKeyPress,
+IPC_MESSAGE_CONTROL3(AutomationMsg_DEPRECATED_WindowKeyPress,
int,
int,
int)
@@ -769,7 +769,7 @@ IPC_SYNC_MESSAGE_CONTROL2_0(AutomationMsg_OpenNewBrowserWindowOfType,
// Request:
// int - the handle of the window that's the context for this click
// gfx::Point - the location to move to
-IPC_MESSAGE_CONTROL2(AutomationMsg_WindowMouseMove,
+IPC_MESSAGE_CONTROL2(AutomationMsg_DEPRECATED_WindowMouseMove,
int,
gfx::Point)
@@ -958,6 +958,14 @@ IPC_SYNC_MESSAGE_CONTROL2_2(AutomationMsg_SendJSONRequest,
std::string /* JSON response */,
bool /* success */)
+// This message requests that a key press be performed.
+// Request:
+// int - tab handle
+// int - the ui::KeyboardCode of the key that was pressed.
+IPC_MESSAGE_CONTROL2(AutomationMsg_KeyPress,
+ int /* tab_handle */,
+ int /* key */)
+
// Browser -> renderer messages.
// Requests a snapshot.
diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc
index 6716da7..eade432c 100644
--- a/chrome/test/automation/browser_proxy.cc
+++ b/chrome/test/automation/browser_proxy.cc
@@ -160,27 +160,6 @@ bool BrowserProxy::ApplyAccelerator(int id) {
return RunCommandAsync(id);
}
-bool BrowserProxy::SimulateDrag(const gfx::Point& start,
- const gfx::Point& end,
- int flags,
- bool press_escape_en_route) {
- if (!is_valid())
- return false;
-
- std::vector<gfx::Point> drag_path;
- drag_path.push_back(start);
- drag_path.push_back(end);
-
- bool result = false;
-
- if (!sender_->Send(new AutomationMsg_WindowDrag(
- handle_, drag_path, flags, press_escape_en_route, &result))) {
- return false;
- }
-
- return result;
-}
-
bool BrowserProxy::WaitForTabCountToBecome(int count) {
bool success = false;
if (!sender_->Send(new AutomationMsg_WaitForTabCountToBecome(
diff --git a/chrome/test/automation/browser_proxy.h b/chrome/test/automation/browser_proxy.h
index 44e0cd3..07d605a 100644
--- a/chrome/test/automation/browser_proxy.h
+++ b/chrome/test/automation/browser_proxy.h
@@ -87,14 +87,6 @@ class BrowserProxy : public AutomationResourceProxy {
// desktop.
bool ApplyAccelerator(int id) WARN_UNUSED_RESULT;
- // Performs a drag operation between the start and end points (both defined
- // in window coordinates). |flags| specifies which buttons are pressed for
- // the drag, as defined in chrome/views/event.h.
- virtual bool SimulateDrag(const gfx::Point& start,
- const gfx::Point& end,
- int flags,
- bool press_escape_en_route) WARN_UNUSED_RESULT;
-
// Block the thread until the tab count is |count|.
// Returns true on success.
bool WaitForTabCountToBecome(int count) WARN_UNUSED_RESULT;
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index ee20842..541f588 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -428,6 +428,10 @@ void TabProxy::Paste() {
sender_->Send(new AutomationMsg_Paste(handle_));
}
+void TabProxy::SimulateKeyPress(ui::KeyboardCode key) {
+ sender_->Send(new AutomationMsg_KeyPress(handle_, key));
+}
+
void TabProxy::ReloadAsync() {
sender_->Send(new AutomationMsg_ReloadAsync(handle_));
}
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index 9c2e973..c72ee3a 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -23,6 +23,7 @@
#include "content/public/common/page_type.h"
#include "content/public/common/security_style.h"
#include "net/base/cert_status_flags.h"
+#include "ui/base/keycodes/keyboard_codes.h"
#include "webkit/glue/window_open_disposition.h"
class BrowserProxy;
@@ -226,6 +227,9 @@ class TabProxy : public AutomationResourceProxy {
void Copy();
void Paste();
+ // Simulates a key press. |key| is the virtual key code of the key pressed.
+ void SimulateKeyPress(ui::KeyboardCode key);
+
// These handlers issue asynchronous Reload, Stop and SaveAs notifications to
// the chrome instance.
void ReloadAsync();
diff --git a/chrome/test/automation/window_proxy.cc b/chrome/test/automation/window_proxy.cc
index aba1329..3d97c58 100644
--- a/chrome/test/automation/window_proxy.cc
+++ b/chrome/test/automation/window_proxy.cc
@@ -16,20 +16,6 @@
#include "googleurl/src/gurl.h"
#include "ui/gfx/rect.h"
-bool WindowProxy::SimulateOSMouseMove(const gfx::Point& location) {
- if (!is_valid()) return false;
-
- return sender_->Send(
- new AutomationMsg_WindowMouseMove(handle_, location));
-}
-
-bool WindowProxy::SimulateOSKeyPress(ui::KeyboardCode key, int flags) {
- if (!is_valid()) return false;
-
- return sender_->Send(
- new AutomationMsg_WindowKeyPress(handle_, key, flags));
-}
-
bool WindowProxy::GetViewBounds(int view_id, gfx::Rect* bounds,
bool screen_coordinates) {
if (!is_valid())
diff --git a/chrome/test/automation/window_proxy.h b/chrome/test/automation/window_proxy.h
index 5461f61..6b574c98 100644
--- a/chrome/test/automation/window_proxy.h
+++ b/chrome/test/automation/window_proxy.h
@@ -14,14 +14,12 @@
#include "base/string16.h"
#include "base/threading/thread.h"
#include "chrome/test/automation/automation_handle_tracker.h"
-#include "ui/base/keycodes/keyboard_codes.h"
class BrowserProxy;
class WindowProxy;
namespace gfx {
- class Point;
- class Rect;
+class Rect;
}
// This class presents the interface to actions that can be performed on a given
@@ -35,16 +33,6 @@ class WindowProxy : public AutomationResourceProxy {
int handle)
: AutomationResourceProxy(tracker, sender, handle) {}
- // Moves the mouse pointer this location at the OS level. |location| is
- // in the window's coordinates.
- bool SimulateOSMouseMove(const gfx::Point& location);
-
- // Simulates a key press at the OS level. |key| is the virtual key code of the
- // key pressed and |flags| specifies which modifiers keys are also pressed (as
- // defined in chrome/views/event.h). Note that this actually sends the event
- // to the window that has focus.
- bool SimulateOSKeyPress(ui::KeyboardCode key, int flags);
-
// Gets the bounds (in window coordinates) that correspond to the view with
// the given ID in this window. Returns true if bounds could be obtained.
// If |screen_coordinates| is true, the bounds are returned in the coordinates
diff --git a/chrome/test/reliability/automated_ui_test_base.cc b/chrome/test/reliability/automated_ui_test_base.cc
index 617b386..426f0ae 100644
--- a/chrome/test/reliability/automated_ui_test_base.cc
+++ b/chrome/test/reliability/automated_ui_test_base.cc
@@ -87,146 +87,6 @@ bool AutomatedUITestBase::DuplicateTab() {
return RunCommand(IDC_DUPLICATE_TAB);
}
-bool AutomatedUITestBase::DragTabOut() {
- BrowserProxy* browser = active_browser();
- if (browser == NULL) {
- LogErrorMessage("browser_window_not_found");
- return false;
- }
-
- scoped_refptr<WindowProxy> window(
- GetAndActivateWindowForBrowser(browser));
- if (window.get() == NULL) {
- LogErrorMessage("active_window_not_found");
- return false;
- }
-
- int tab_count;
- if (!browser->GetTabCount(&tab_count)) {
- LogErrorMessage("get_tab_count_failed");
- return false;
- }
-
- if (tab_count < 2) {
- LogWarningMessage("not_enough_tabs_to_drag_out");
- return false;
- }
-
- int tab_index;
- if (!browser->GetActiveTabIndex(&tab_index)) {
- LogWarningMessage("no_active_tab");
- return false;
- }
-
- if (tab_index < 0) {
- LogInfoMessage("invalid_active_tab_index");
- return false;
- }
-
- gfx::Rect dragged_tab_bounds;
- if (!window->GetViewBounds(VIEW_ID_TAB_0 + tab_index,
- &dragged_tab_bounds, false)) {
- LogWarningMessage("no_tab_view_found");
- return false;
- }
-
- gfx::Rect urlbar_bounds;
- if (!window->GetViewBounds(VIEW_ID_LOCATION_BAR,
- &urlbar_bounds, false)) {
- LogWarningMessage("no_location_bar_found");
- return false;
- }
-
- // Click on the center of the tab, and drag it downwards.
- gfx::Point start;
- gfx::Point end;
- start.set_x(dragged_tab_bounds.x() + dragged_tab_bounds.width() / 2);
- start.set_y(dragged_tab_bounds.y() + dragged_tab_bounds.height() / 2);
- end.set_x(start.x());
- end.set_y(start.y() + 3 * urlbar_bounds.height());
-
- if (!browser->SimulateDrag(start, end, ui::EF_LEFT_MOUSE_BUTTON, false)) {
- LogWarningMessage("failed_to_simulate_drag");
- return false;
- }
-
- return true;
-}
-
-bool AutomatedUITestBase::DragActiveTab(bool drag_right) {
- BrowserProxy* browser = active_browser();
- if (browser == NULL) {
- LogErrorMessage("browser_window_not_found");
- return false;
- }
-
- scoped_refptr<WindowProxy> window(
- GetAndActivateWindowForBrowser(browser));
- if (window.get() == NULL) {
- LogErrorMessage("active_window_not_found");
- return false;
- }
-
- int tab_count;
- if (!browser->GetTabCount(&tab_count)) {
- LogErrorMessage("get_tab_count_failed");
- return false;
- }
-
- if (tab_count < 2) {
- LogWarningMessage("not_enough_tabs_to_drag_around");
- return false;
- }
-
- int tab_index;
- if (!browser->GetActiveTabIndex(&tab_index)) {
- LogWarningMessage("no_active_tab");
- return false;
- }
-
- gfx::Rect dragged_tab_bounds;
- if (!window->GetViewBounds(VIEW_ID_TAB_0 + tab_index,
- &dragged_tab_bounds, false)) {
- LogWarningMessage("no_tab_view_found");
- return false;
- }
-
- // Click on the center of the tab, and drag it to the left or the right.
- gfx::Point dragged_tab_point = dragged_tab_bounds.CenterPoint();
- gfx::Point destination_point = dragged_tab_point;
-
- int new_tab_index;
- if (drag_right) {
- if (tab_index >= (tab_count - 1)) {
- LogInfoMessage("cant_drag_to_right");
- return false;
- }
- new_tab_index = tab_index + 1;
- destination_point.Offset(2 * dragged_tab_bounds.width() / 3, 0);
- } else {
- if (tab_index <= 0) {
- LogInfoMessage("cant_drag_to_left");
- return false;
- }
- new_tab_index = tab_index - 1;
- destination_point.Offset(-2 * dragged_tab_bounds.width() / 3, 0);
- }
-
- if (!browser->SimulateDrag(dragged_tab_point, destination_point,
- ui::EF_LEFT_MOUSE_BUTTON, false)) {
- LogWarningMessage("failed_to_simulate_drag");
- return false;
- }
-
- if (!browser->WaitForTabToBecomeActive(new_tab_index,
- TestTimeouts::action_timeout())) {
- LogWarningMessage("failed_to_reindex_tab");
- return false;
- }
-
- return true;
-}
-
bool AutomatedUITestBase::FindInPage() {
if (!RunCommandAsync(IDC_FIND))
return false;
diff --git a/chrome/test/reliability/automated_ui_test_base.h b/chrome/test/reliability/automated_ui_test_base.h
index 8fbf138..fce6773 100644
--- a/chrome/test/reliability/automated_ui_test_base.h
+++ b/chrome/test/reliability/automated_ui_test_base.h
@@ -46,21 +46,6 @@ class AutomatedUITestBase : public UITest {
// Returns true if a duplicated tab is added.
bool DuplicateTab();
- // Drags the active tab. The tab is dragged vertically to remove it from the
- // tabstrip. Returns true if the tab is dragged, false otherwise.
- // Note: returning true doesn't necessarily create a new window as the tab
- // could be dragged in to another window.
- bool DragTabOut();
-
- // Drags the active tab.
- // If |drag_right| is true, if there is a tab to the right of the active tab,
- // the active tab is dragged to that tabs position. If |drag_right| is false,
- // if there is a tab to the left of the active tab, the active tab is dragged
- // to that tabs position. Returns true if the tab is dragged. If it returns
- // false, the tab is not dragged, probably because no other tab exists to
- // drag the active tab over.
- bool DragActiveTab(bool drag_right);
-
// Activates "find in page" on the current page. Returns true on success.
bool FindInPage();
diff --git a/chrome/test/reliability/automated_ui_test_interactive_test.cc b/chrome/test/reliability/automated_ui_test_interactive_test.cc
deleted file mode 100644
index 04c0969..0000000
--- a/chrome/test/reliability/automated_ui_test_interactive_test.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/test/test_timeouts.h"
-#include "base/threading/platform_thread.h"
-#include "chrome/test/automation/automation_proxy.h"
-#include "chrome/test/automation/browser_proxy.h"
-#include "chrome/test/automation/tab_proxy.h"
-#include "chrome/test/reliability/automated_ui_test_base.h"
-#include "chrome/test/ui/ui_test.h"
-
-TEST_F(AutomatedUITestBase, DragOut) {
- NewTab();
- NewTab();
- ASSERT_TRUE(active_browser()->WaitForTabCountToBecome(3));
- base::PlatformThread::Sleep(TestTimeouts::action_timeout());
- ASSERT_TRUE(DragTabOut());
- int window_count;
- ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count));
- ASSERT_EQ(2, window_count);
-}
-
-TEST_F(AutomatedUITestBase, DragLeftRight) {
- NewTab();
- NewTab();
- ASSERT_TRUE(active_browser()->WaitForTabCountToBecome(3));
- // TODO(phajdan.jr): We need a WaitForTabstripAnimationsToEnd() function.
- // Every sleep in this file should be replaced with it.
- const base::TimeDelta kDelay = TestTimeouts::action_timeout();
- base::PlatformThread::Sleep(kDelay);
-
- scoped_refptr<TabProxy> dragged_tab(active_browser()->GetActiveTab());
- int tab_index;
- ASSERT_TRUE(dragged_tab->GetTabIndex(&tab_index));
- EXPECT_EQ(2, tab_index);
-
- // Drag the active tab to left. Now it should be the middle tab.
- ASSERT_TRUE(DragActiveTab(false));
- // We wait for the animation to be over.
- base::PlatformThread::Sleep(kDelay);
- ASSERT_TRUE(dragged_tab->GetTabIndex(&tab_index));
- EXPECT_EQ(1, tab_index);
-
- // Drag the active tab to left. Now it should be the leftmost tab.
- ASSERT_TRUE(DragActiveTab(false));
- base::PlatformThread::Sleep(kDelay);
- ASSERT_TRUE(dragged_tab->GetTabIndex(&tab_index));
- EXPECT_EQ(0, tab_index);
-
- // Drag the active tab to left. It should fail since the active tab is
- // already the leftmost tab.
- ASSERT_FALSE(DragActiveTab(false));
-
- // Drag the active tab to right. Now it should be the middle tab.
- ASSERT_TRUE(DragActiveTab(true));
- base::PlatformThread::Sleep(kDelay);
- ASSERT_TRUE(dragged_tab->GetTabIndex(&tab_index));
- EXPECT_EQ(1, tab_index);
-
- // Drag the active tab to right. Now it should be the rightmost tab.
- ASSERT_TRUE(DragActiveTab(true));
- base::PlatformThread::Sleep(kDelay);
- ASSERT_TRUE(dragged_tab->GetTabIndex(&tab_index));
- EXPECT_EQ(2, tab_index);
-
- // Drag the active tab to right. It should fail since the active tab is
- // already the rightmost tab.
- ASSERT_FALSE(DragActiveTab(true));
-}
diff --git a/chrome/test/reliability/automated_ui_tests.cc b/chrome/test/reliability/automated_ui_tests.cc
index b214c68..6b78a4a 100644
--- a/chrome/test/reliability/automated_ui_tests.cc
+++ b/chrome/test/reliability/automated_ui_tests.cc
@@ -391,12 +391,6 @@ bool AutomatedUITest::DoAction(const std::string& action) {
did_complete_action = PressDownArrow();
} else if (LowerCaseEqualsASCII(action, "downloads")) {
did_complete_action = ShowDownloads();
- } else if (LowerCaseEqualsASCII(action, "dragtableft")) {
- did_complete_action = DragActiveTab(false);
- } else if (LowerCaseEqualsASCII(action, "dragtabout")) {
- did_complete_action = DragTabOut();
- } else if (LowerCaseEqualsASCII(action, "dragtabright")) {
- did_complete_action = DragActiveTab(true);
} else if (LowerCaseEqualsASCII(action, "duplicatetab")) {
did_complete_action = DuplicateTab();
} else if (LowerCaseEqualsASCII(action, "editsearchengines")) {
@@ -559,35 +553,35 @@ bool AutomatedUITest::Options() {
}
bool AutomatedUITest::PressDownArrow() {
- return SimulateKeyPressInActiveWindow(ui::VKEY_DOWN, 0);
+ return SimulateKeyPress(ui::VKEY_DOWN);
}
bool AutomatedUITest::PressEnterKey() {
- return SimulateKeyPressInActiveWindow(ui::VKEY_RETURN, 0);
+ return SimulateKeyPress(ui::VKEY_RETURN);
}
bool AutomatedUITest::PressEscapeKey() {
- return SimulateKeyPressInActiveWindow(ui::VKEY_ESCAPE, 0);
+ return SimulateKeyPress(ui::VKEY_ESCAPE);
}
bool AutomatedUITest::PressPageDown() {
- return SimulateKeyPressInActiveWindow(ui::VKEY_PRIOR, 0);
+ return SimulateKeyPress(ui::VKEY_PRIOR);
}
bool AutomatedUITest::PressPageUp() {
- return SimulateKeyPressInActiveWindow(ui::VKEY_NEXT, 0);
+ return SimulateKeyPress(ui::VKEY_NEXT);
}
bool AutomatedUITest::PressSpaceBar() {
- return SimulateKeyPressInActiveWindow(ui::VKEY_SPACE, 0);
+ return SimulateKeyPress(ui::VKEY_SPACE);
}
bool AutomatedUITest::PressTabKey() {
- return SimulateKeyPressInActiveWindow(ui::VKEY_TAB, 0);
+ return SimulateKeyPress(ui::VKEY_TAB);
}
bool AutomatedUITest::PressUpArrow() {
- return SimulateKeyPressInActiveWindow(ui::VKEY_UP, 0);
+ return SimulateKeyPress(ui::VKEY_UP);
}
bool AutomatedUITest::StarPage() {
@@ -677,18 +671,9 @@ bool AutomatedUITest::ForceCrash() {
return true;
}
-bool AutomatedUITest::SimulateKeyPressInActiveWindow(ui::KeyboardCode key,
- int flags) {
- scoped_refptr<BrowserProxy> browser(active_browser());
- scoped_refptr<WindowProxy> window(browser->GetWindow());
- if (window.get() == NULL) {
- AddErrorAttribute("active_window_not_found");
- return false;
- }
- if (!window->SimulateOSKeyPress(key, flags)) {
- AddWarningAttribute("failure_simulating_key_press");
- return false;
- }
+bool AutomatedUITest::SimulateKeyPress(ui::KeyboardCode key) {
+ scoped_refptr<TabProxy> tab(GetActiveTab());
+ tab->SimulateKeyPress(key);
return true;
}
diff --git a/chrome/test/reliability/automated_ui_tests.h b/chrome/test/reliability/automated_ui_tests.h
index cf9cb24..5a05c07 100644
--- a/chrome/test/reliability/automated_ui_tests.h
+++ b/chrome/test/reliability/automated_ui_tests.h
@@ -292,10 +292,8 @@ class AutomatedUITest : public AutomatedUITestBase {
// Utility functions --------------------------------------------------------
- // Calls SimulateOSKeyPress on the active window. Simulates a key press at
- // the OS level. |key| is the key pressed and |flags| specifies which
- // modifiers keys are also pressed (as defined in chrome/views/event.h).
- bool SimulateKeyPressInActiveWindow(ui::KeyboardCode key, int flags);
+ // Calls SimulateKeyPress on the active tab. |key| is the key pressed.
+ bool SimulateKeyPress(ui::KeyboardCode key);
// Opens init file, reads it into the reader, and closes the file.
// Returns false if there are any errors.
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc
index c0590d0..ce333e8 100644
--- a/chrome/test/reliability/page_load_test.cc
+++ b/chrome/test/reliability/page_load_test.cc
@@ -353,22 +353,13 @@ class PageLoadTest : public UITest {
if (result == AUTOMATION_MSG_NAVIGATION_SUCCESS) {
if (g_page_down) {
// Page down twice.
- scoped_refptr<BrowserProxy> browser(
- automation()->GetBrowserWindow(0));
- if (browser.get()) {
- scoped_refptr<WindowProxy> window(browser->GetWindow());
- if (window.get()) {
- if (browser->BringToFront()) {
- // Sleep for 2 seconds between commands.
- // This used to be settable but the flag went away.
- base::TimeDelta sleep_time = base::TimeDelta::FromSeconds(2);
- window->SimulateOSKeyPress(ui::VKEY_NEXT, 0);
- base::PlatformThread::Sleep(sleep_time);
- window->SimulateOSKeyPress(ui::VKEY_NEXT, 0);
- base::PlatformThread::Sleep(sleep_time);
- }
- }
- }
+ // Sleep for 2 seconds between commands.
+ // This used to be settable but the flag went away.
+ base::TimeDelta sleep_time = base::TimeDelta::FromSeconds(2);
+ tab_proxy->SimulateKeyPress(ui::VKEY_NEXT);
+ base::PlatformThread::Sleep(sleep_time);
+ tab_proxy->SimulateKeyPress(ui::VKEY_NEXT);
+ base::PlatformThread::Sleep(sleep_time);
}
}
}