summaryrefslogtreecommitdiffstats
path: root/webkit/tools
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
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')
-rw-r--r--webkit/tools/layout_tests/test_expectations.txt8
-rw-r--r--webkit/tools/test_shell/event_sending_controller.cc36
-rw-r--r--webkit/tools/test_shell/event_sending_controller.h3
3 files changed, 40 insertions, 7 deletions
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt
index a134f44..fa62d16 100644
--- a/webkit/tools/layout_tests/test_expectations.txt
+++ b/webkit/tools/layout_tests/test_expectations.txt
@@ -728,12 +728,8 @@ BUG13907 SKIP : LayoutTests/media/video-empty-source.html = TIMEOUT
BUG13907 : LayoutTests/fast/layers/video-layer.html = FAIL
BUG13907 WIN : LayoutTests/media/event-attributes.html = FAIL
-// Requires the test shell to support eventSender.beginDragWithFiles().
-BUG19884 SKIP : LayoutTests/fast/forms/get-file-upload.html = TIMEOUT
-BUG19884 SKIP : LayoutTests/fast/events/drag-to-navigate.html = TIMEOUT FAIL
-BUG19884 : LayoutTests/fast/events/prevent-drag-to-navigate.html = TIMEOUT
-BUG19884 : LayoutTests/editing/pasteboard/file-input-files-access.html = FAIL
-BUG19884 SKIP : LayoutTests/http/tests/security/clipboard/clipboard-file-access.html = FAIL
+// Crash on Mac and Linux. Need investigation.
+BUG_JIANLI MAC LINUX : LayoutTests/fast/events/drag-to-navigate.html = CRASH
// Function arguments object is copied for each access.
BUG941049 : LayoutTests/fast/js/kde/function_arguments.html = FAIL
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
//
diff --git a/webkit/tools/test_shell/event_sending_controller.h b/webkit/tools/test_shell/event_sending_controller.h
index 5f26083..409e0f2 100644
--- a/webkit/tools/test_shell/event_sending_controller.h
+++ b/webkit/tools/test_shell/event_sending_controller.h
@@ -59,13 +59,14 @@ class EventSendingController : public CppBoundClass {
void zoomPageOut(const CppArgumentList& args, CppVariant* result);
void scheduleAsynchronousClick(const CppArgumentList& args,
CppVariant* result);
+ void beginDragWithFiles(const CppArgumentList& args, CppVariant* result);
+ CppVariant dragMode;
// Unimplemented stubs
void contextClick(const CppArgumentList& args, CppVariant* result);
void enableDOMUIEventLogging(const CppArgumentList& args, CppVariant* result);
void fireKeyboardEventsToElement(const CppArgumentList& args, CppVariant* result);
void clearKillRing(const CppArgumentList& args, CppVariant* result);
- CppVariant dragMode;
// Properties used in layout tests.
#if defined(OS_WIN)