summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/event_sending_controller.cc
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-08 23:48:48 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-08 23:48:48 +0000
commit31c8bca422ad6bdfc2681a14cdfeaaf65c3c7dbe (patch)
treecb8e72e5ec7f3ae943fac9d0cd07f4a50a307c93 /webkit/tools/test_shell/event_sending_controller.cc
parent2810329112a21cdfe44ef3ae167560429c157829 (diff)
downloadchromium_src-31c8bca422ad6bdfc2681a14cdfeaaf65c3c7dbe.zip
chromium_src-31c8bca422ad6bdfc2681a14cdfeaaf65c3c7dbe.tar.gz
chromium_src-31c8bca422ad6bdfc2681a14cdfeaaf65c3c7dbe.tar.bz2
Add beginDragWithFiles to EventSendingController. Also implement WebKitClientImpl::fileExists. With these, we're able to enable all drag-file related layout tests.
BUG=19884 TEST=none Review URL: http://codereview.chromium.org/187015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25683 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/event_sending_controller.cc')
-rw-r--r--webkit/tools/test_shell/event_sending_controller.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc
index 15d54f6..6d24a52 100644
--- a/webkit/tools/test_shell/event_sending_controller.cc
+++ b/webkit/tools/test_shell/event_sending_controller.cc
@@ -26,12 +26,17 @@
#include <queue>
#include "base/compiler_specific.h"
+#include "base/file_path.h"
+#include "base/file_util.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/time.h"
#include "webkit/api/public/WebDragData.h"
+#include "webkit/api/public/WebDragOperation.h"
#include "webkit/api/public/WebPoint.h"
+#include "webkit/api/public/WebString.h"
+#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webview.h"
#include "webkit/tools/test_shell/test_shell.h"
@@ -52,6 +57,7 @@ using WebKit::WebInputEvent;
using WebKit::WebKeyboardEvent;
using WebKit::WebMouseEvent;
using WebKit::WebPoint;
+using WebKit::WebString;
TestShell* EventSendingController::shell_ = NULL;
gfx::Point EventSendingController::last_mouse_pos_;
@@ -171,6 +177,8 @@ EventSendingController::EventSendingController(TestShell* shell)
BindMethod("zoomPageOut", &EventSendingController::zoomPageOut);
BindMethod("scheduleAsynchronousClick",
&EventSendingController::scheduleAsynchronousClick);
+ BindMethod("beginDragWithFiles",
+ &EventSendingController::beginDragWithFiles);
// When set to true (the default value), we batch mouse move and mouse up
// events so we can simulate drag & drop.
@@ -615,6 +623,34 @@ void EventSendingController::scheduleAsynchronousClick(
args, static_cast<CppVariant*>(NULL)));
}
+void EventSendingController::beginDragWithFiles(
+ const CppArgumentList& args, CppVariant* result) {
+ current_drag_data.initialize();
+ std::vector<std::wstring> files = args[0].ToStringVector();
+ for (size_t i = 0; i < files.size(); ++i) {
+ FilePath file_path = FilePath::FromWStringHack(files[i]);
+ file_util::AbsolutePath(&file_path);
+ current_drag_data.appendToFileNames(
+ webkit_glue::FilePathStringToWebString(file_path.value()));
+ }
+ current_drag_effects_allowed = WebKit::WebDragOperationCopy;
+
+ // Provide a drag source.
+ WebPoint client_point(last_mouse_pos_.x(), last_mouse_pos_.y());
+ WebPoint screen_point(last_mouse_pos_.x(), last_mouse_pos_.y());
+ webview()->DragTargetDragEnter(current_drag_data, 0,
+ client_point, screen_point,
+ current_drag_effects_allowed);
+
+ // dragMode saves events and then replays them later. We don't need/want that.
+ dragMode.Set(false);
+
+ // Make the rest of eventSender think a drag is in progress.
+ pressed_button_ = WebMouseEvent::ButtonLeft;
+
+ result->SetNull();
+}
+
//
// Unimplemented stubs
//