summaryrefslogtreecommitdiffstats
path: root/webkit/tools
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-12 21:01:11 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-12 21:01:11 +0000
commitcb42d4d11b9f03d76d914648cb8ad362f80c9b57 (patch)
treef6714f0bd185a8959f3fc3186f94476aaff4017c /webkit/tools
parente24b70c4852ca81ac9719942d82bc753256904d7 (diff)
downloadchromium_src-cb42d4d11b9f03d76d914648cb8ad362f80c9b57.zip
chromium_src-cb42d4d11b9f03d76d914648cb8ad362f80c9b57.tar.gz
chromium_src-cb42d4d11b9f03d76d914648cb8ad362f80c9b57.tar.bz2
This adds the implementation for the JS method eventSender.scheduleAsynchronousClick which makes the test
LayoutTests/fast/events/popup-blocking-click-in-iframe.html pass. Review URL: http://codereview.chromium.org/20320 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9704 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r--webkit/tools/layout_tests/test_lists/tests_fixable.txt3
-rw-r--r--webkit/tools/test_shell/event_sending_controller.cc31
-rw-r--r--webkit/tools/test_shell/event_sending_controller.h5
3 files changed, 31 insertions, 8 deletions
diff --git a/webkit/tools/layout_tests/test_lists/tests_fixable.txt b/webkit/tools/layout_tests/test_lists/tests_fixable.txt
index bd1ec332..c5b153e 100644
--- a/webkit/tools/layout_tests/test_lists/tests_fixable.txt
+++ b/webkit/tools/layout_tests/test_lists/tests_fixable.txt
@@ -1542,9 +1542,6 @@ DEFER : LayoutTests/fast/forms/search-cancel-button-style-sharing.html = FAIL
DEFER : LayoutTests/fast/forms/search-rtl.html = FAIL
DEFER : LayoutTests/fast/forms/search-transformed.html = FAIL
-// Merge 39369:39410: new test
-LayoutTests/fast/events/popup-blocking-click-in-iframe.html = FAIL TIMEOUT
-
// Merge 39369:39410: new test. Ran correctly and was baselined on Win32.
MAC : LayoutTests/fast/reflections/reflection-overflow-hidden.html = PASS FAIL
diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc
index 4a067b1..76e8a06 100644
--- a/webkit/tools/test_shell/event_sending_controller.cc
+++ b/webkit/tools/test_shell/event_sending_controller.cc
@@ -23,7 +23,9 @@
#include "config.h"
#include "KeyboardCodes.h"
+#include "base/compiler_specific.h"
#include "base/logging.h"
+#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/string_util.h"
#include "base/time.h"
@@ -122,7 +124,8 @@ void ApplyKeyModifiers(const CppVariant* arg, WebKeyboardEvent* event) {
} // anonymous namespace
-EventSendingController::EventSendingController(TestShell* shell) {
+EventSendingController::EventSendingController(TestShell* shell)
+ : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
// Set static shell_ variable since we can't do it in an initializer list.
// We also need to be careful not to assign shell_ to new windows which are
// temporary.
@@ -140,11 +143,15 @@ EventSendingController::EventSendingController(TestShell* shell) {
BindMethod("leapForward", &EventSendingController::leapForward);
BindMethod("keyDown", &EventSendingController::keyDown);
BindMethod("dispatchMessage", &EventSendingController::dispatchMessage);
- BindMethod("enableDOMUIEventLogging", &EventSendingController::enableDOMUIEventLogging);
- BindMethod("fireKeyboardEventsToElement", &EventSendingController::fireKeyboardEventsToElement);
+ BindMethod("enableDOMUIEventLogging",
+ &EventSendingController::enableDOMUIEventLogging);
+ BindMethod("fireKeyboardEventsToElement",
+ &EventSendingController::fireKeyboardEventsToElement);
BindMethod("clearKillRing", &EventSendingController::clearKillRing);
BindMethod("textZoomIn", &EventSendingController::textZoomIn);
BindMethod("textZoomOut", &EventSendingController::textZoomOut);
+ BindMethod("scheduleAsynchronousClick",
+ &EventSendingController::scheduleAsynchronousClick);
// When set to true (the default value), we batch mouse move and mouse up
// events so we can simulate drag & drop.
@@ -224,7 +231,8 @@ int EventSendingController::GetButtonNumberFromSingleArg(
void EventSendingController::mouseDown(
const CppArgumentList& args, CppVariant* result) {
- result->SetNull();
+ if (result) // Could be NULL if invoked asynchronously.
+ result->SetNull();
webview()->Layout();
@@ -253,7 +261,8 @@ void EventSendingController::mouseDown(
void EventSendingController::mouseUp(
const CppArgumentList& args, CppVariant* result) {
- result->SetNull();
+ if (result) // Could be NULL if invoked asynchronously.
+ result->SetNull();
webview()->Layout();
@@ -517,6 +526,18 @@ void EventSendingController::contextClick(
pressed_button_ = WebMouseEvent::BUTTON_NONE;
}
+void EventSendingController::scheduleAsynchronousClick(
+ const CppArgumentList& args, CppVariant* result) {
+ result->SetNull();
+
+ MessageLoop::current()->PostTask(FROM_HERE,
+ method_factory_.NewRunnableMethod(&EventSendingController::mouseDown,
+ args, static_cast<CppVariant*>(NULL)));
+ MessageLoop::current()->PostTask(FROM_HERE,
+ method_factory_.NewRunnableMethod(&EventSendingController::mouseUp,
+ args, static_cast<CppVariant*>(NULL)));
+}
+
//
// Unimplemented stubs
//
diff --git a/webkit/tools/test_shell/event_sending_controller.h b/webkit/tools/test_shell/event_sending_controller.h
index ca16356..cd3bf78 100644
--- a/webkit/tools/test_shell/event_sending_controller.h
+++ b/webkit/tools/test_shell/event_sending_controller.h
@@ -18,6 +18,7 @@
#include "build/build_config.h"
#include "base/gfx/point.h"
+#include "base/task.h"
#include "webkit/glue/cpp_bound_class.h"
#include "webkit/glue/webdropdata.h"
#include "webkit/glue/webinputevent.h"
@@ -46,6 +47,8 @@ class EventSendingController : public CppBoundClass {
void dispatchMessage(const CppArgumentList& args, CppVariant* result);
void textZoomIn(const CppArgumentList& args, CppVariant* result);
void textZoomOut(const CppArgumentList& args, CppVariant* result);
+ void scheduleAsynchronousClick(const CppArgumentList& args,
+ CppVariant* result);
// Unimplemented stubs
void contextClick(const CppArgumentList& args, CppVariant* result);
@@ -90,6 +93,8 @@ class EventSendingController : public CppBoundClass {
// be passed into the generated event.
bool NeedsShiftModifer(int key_code);
+ ScopedRunnableMethodFactory<EventSendingController> method_factory_;
+
// Non-owning pointer. The LayoutTestController is owned by the host.
static TestShell* shell_;