summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 22:47:20 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-16 22:47:20 +0000
commit4f7336749506dead4f348f37171eda7165b5abb3 (patch)
treebf77d11330cc7c9b63d718a6fad5b038cbd706be /webkit
parent21e1e7dd3aaec080af56a91c7054565234f5e289 (diff)
downloadchromium_src-4f7336749506dead4f348f37171eda7165b5abb3.zip
chromium_src-4f7336749506dead4f348f37171eda7165b5abb3.tar.gz
chromium_src-4f7336749506dead4f348f37171eda7165b5abb3.tar.bz2
Revert 41769 - Fix test_shell so that eventSender works for opened windows. I've also made focus go to the webview, just like what happens in Chrome.
This is needed for https://bugs.webkit.org/show_bug.cgi?id=36147 and also fixes plugins/keyboardevents.html on Windows. Review URL: http://codereview.chromium.org/1011005 TBR=jam@chromium.org Review URL: http://codereview.chromium.org/997008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41781 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/data/layout_tests/platform/chromium-win/LayoutTests/http/tests/plugins/plugin-document-has-focus-expected.txt3
-rw-r--r--webkit/data/layout_tests/platform/chromium-win/LayoutTests/plugins/README10
-rw-r--r--webkit/data/layout_tests/platform/chromium-win/LayoutTests/plugins/keyboard-events-expected.txt11
-rw-r--r--webkit/tools/layout_tests/test_expectations.txt7
-rw-r--r--webkit/tools/npapi_layout_test_plugin/PluginObject.cpp1
-rw-r--r--webkit/tools/npapi_layout_test_plugin/PluginObject.h1
-rw-r--r--webkit/tools/npapi_layout_test_plugin/main.cpp24
-rw-r--r--webkit/tools/test_shell/event_sending_controller.cc14
-rw-r--r--webkit/tools/test_shell/event_sending_controller.h16
-rw-r--r--webkit/tools/test_shell/test_shell.h3
-rw-r--r--webkit/tools/test_shell/test_shell_win.cc18
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc3
12 files changed, 40 insertions, 71 deletions
diff --git a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/http/tests/plugins/plugin-document-has-focus-expected.txt b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/http/tests/plugins/plugin-document-has-focus-expected.txt
deleted file mode 100644
index 07a9506..0000000
--- a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/http/tests/plugins/plugin-document-has-focus-expected.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-CONSOLE MESSAGE: line 1: PLUGIN: keyDown 'A'
-CONSOLE MESSAGE: line 1: PLUGIN: keyUp 'A'
-This tests that a full page plugin gets keyboard focus without the need to first click it. \ No newline at end of file
diff --git a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/plugins/README b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/plugins/README
index 5e2667d..b3f7df8 100644
--- a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/plugins/README
+++ b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/plugins/README
@@ -4,12 +4,4 @@ inner-html-display-none
-----------------------
The only difference is whitespace differences in the
-way functions are printed.
-
-
-keyboard-events
----------------
-
-On Windows, windowless plugins get the shift state of the keyboard by quering the OS, since the
-WM_KEYDOWN message doesn't contain that information. This is impossible to simulate through
-eventSender(). \ No newline at end of file
+way functions are printed. \ No newline at end of file
diff --git a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/plugins/keyboard-events-expected.txt b/webkit/data/layout_tests/platform/chromium-win/LayoutTests/plugins/keyboard-events-expected.txt
deleted file mode 100644
index c944349..0000000
--- a/webkit/data/layout_tests/platform/chromium-win/LayoutTests/plugins/keyboard-events-expected.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-CONSOLE MESSAGE: line 17: PLUGIN: getFocusEvent
-CONSOLE MESSAGE: line 17: PLUGIN: mouseDown at (20, 20)
-CONSOLE MESSAGE: line 18: PLUGIN: mouseUp at (20, 20)
-CONSOLE MESSAGE: line 21: PLUGIN: keyDown 'A'
-CONSOLE MESSAGE: line 21: PLUGIN: keyUp 'A'
-CONSOLE MESSAGE: line 22: PLUGIN: keyDown 'B'
-CONSOLE MESSAGE: line 22: PLUGIN: keyUp 'B'
-CONSOLE MESSAGE: line 23: PLUGIN: keyDown 'C'
-CONSOLE MESSAGE: line 23: PLUGIN: keyUp 'C'
-
-This test checks if a plug-in can receive keyboard events sent from eventSender. This is a test for Bug 34936.
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt
index 66b3cb4..624a893 100644
--- a/webkit/tools/layout_tests/test_expectations.txt
+++ b/webkit/tools/layout_tests/test_expectations.txt
@@ -2789,6 +2789,7 @@ BUG37896 WIN DEBUG : fast/text/firstline/001.html = PASS CRASH
BUG37896 LINUX MAC DEBUG : fast/text/firstline/001.html = PASS CRASH TIMEOUT
// Added in http://trac.webkit.org/changeset/55587
BUG37896 : media/video-preload.html = TEXT
+BUG37896 : plugins/keyboard-events.html = TEXT
BUG37896 LINUX DEBUG : fast/images/svg-as-background.html = TIMEOUT
BUG37869 LINUX : fast/images/animated-svg-as-image.html = IMAGE
BUG37869 MAC LINUX SKIP : inspector/timeline-network-resource.html = CRASH
@@ -2830,9 +2831,5 @@ BUG36415 : fast/events/touch/basic-multi-touch-events.html = TEXT
// Most touch tests flaky on WIN for reasons currently unknown.
BUG38347 WIN : fast/events/touch = TEXT PASS
-// Need to implement NPP_HandleEvent in the layout_test_plugin
-BUG38353 MAC LINUX : plugins/keyboard-events.html = TEXT
-BUG38353 MAC LINUX : http/tests/plugins/plugin-document-has-focus.html = TEXT
-
// will rebaseline
-BUG_DGLAZKOV WIN : svg/text/text-intro-05-t.svg = FAIL \ No newline at end of file
+BUG_DGLAZKOV WIN : svg/text/text-intro-05-t.svg = FAIL
diff --git a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
index 026d74f..4b310ef 100644
--- a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
+++ b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
@@ -982,7 +982,6 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
newInstance->testDocumentOpenInDestroyStream = FALSE;
newInstance->testWindowOpen = FALSE;
- newInstance->testKeyboardFocusForPlugins = FALSE;
return (NPObject*)newInstance;
}
diff --git a/webkit/tools/npapi_layout_test_plugin/PluginObject.h b/webkit/tools/npapi_layout_test_plugin/PluginObject.h
index 8cd63ef..5cab228 100644
--- a/webkit/tools/npapi_layout_test_plugin/PluginObject.h
+++ b/webkit/tools/npapi_layout_test_plugin/PluginObject.h
@@ -38,7 +38,6 @@ typedef struct {
NPStream* stream;
NPBool testWindowOpen;
NPBool testDocumentOpenInDestroyStream;
- NPBool testKeyboardFocusForPlugins;
char* onStreamLoad;
char* onStreamDestroy;
char* onURLNotify;
diff --git a/webkit/tools/npapi_layout_test_plugin/main.cpp b/webkit/tools/npapi_layout_test_plugin/main.cpp
index 9ff3ebb..a644d03 100644
--- a/webkit/tools/npapi_layout_test_plugin/main.cpp
+++ b/webkit/tools/npapi_layout_test_plugin/main.cpp
@@ -140,8 +140,7 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
obj->testDocumentOpenInDestroyStream = TRUE;
} else if (strcasecmp(argn[i], "testwindowopen") == 0) {
obj->testWindowOpen = TRUE;
- } else if (strcasecmp(argn[i], "src") == 0 && strstr(argv[i], "plugin-document-has-focus.pl"))
- obj->testKeyboardFocusForPlugins = TRUE;
+ }
}
instance->pdata = obj;
@@ -183,18 +182,13 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window)
if (obj->logSetWindow) {
log(instance, "NPP_SetWindow: %d %d", (int)window->width, (int)window->height);
fflush(stdout);
- obj->logSetWindow = FALSE;
+ obj->logSetWindow = false;
}
if (obj->testWindowOpen) {
testWindowOpen(instance);
obj->testWindowOpen = FALSE;
}
-
- if (obj->testKeyboardFocusForPlugins) {
- obj->eventLogging = true;
- executeScript(obj, "eventSender.keyDown('A');");
- }
}
return NPERR_NO_ERROR;
@@ -298,17 +292,17 @@ int16 NPP_HandleEvent(NPP instance, void *event)
case WM_RBUTTONDBLCLK:
break;
case WM_MOUSEMOVE:
+ log(instance, "adjustCursorEvent");
break;
case WM_KEYUP:
- log(instance, "keyUp '%c'", MapVirtualKey(evt->wParam, MAPVK_VK_TO_CHAR));
- if (obj->testKeyboardFocusForPlugins) {
- obj->eventLogging = false;
- obj->testKeyboardFocusForPlugins = FALSE;
- executeScript(obj, "layoutTestController.notifyDone();");
- }
+ // TODO(tc): We need to convert evt->wParam from virtual-key code
+ // to key code.
+ log(instance, "NOTIMPLEMENTED: keyUp '%c'", ' ');
break;
case WM_KEYDOWN:
- log(instance, "keyDown '%c'", MapVirtualKey(evt->wParam, MAPVK_VK_TO_CHAR));
+ // TODO(tc): We need to convert evt->wParam from virtual-key code
+ // to key code.
+ log(instance, "NOTIMPLEMENTED: keyDown '%c'", ' ');
break;
case WM_SETCURSOR:
break;
diff --git a/webkit/tools/test_shell/event_sending_controller.cc b/webkit/tools/test_shell/event_sending_controller.cc
index 9cc100f..2ab01a0 100644
--- a/webkit/tools/test_shell/event_sending_controller.cc
+++ b/webkit/tools/test_shell/event_sending_controller.cc
@@ -60,6 +60,7 @@ using WebKit::WebTouchEvent;
using WebKit::WebTouchPoint;
using WebKit::WebView;
+TestShell* EventSendingController::shell_ = NULL;
gfx::Point EventSendingController::last_mouse_pos_;
WebMouseEvent::Button EventSendingController::pressed_button_ =
WebMouseEvent::ButtonNone;
@@ -251,8 +252,13 @@ enum KeyLocationCode {
} // anonymous namespace
EventSendingController::EventSendingController(TestShell* shell)
- : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
- shell_(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.
+ if (NULL == shell_)
+ shell_ = shell;
+
// Initialize the map that associates methods of this class with the names
// they will use when called by JavaScript. The actual binding of those
// names to their methods will be done by calling BindToJavaScript() (defined
@@ -332,10 +338,12 @@ void EventSendingController::Reset() {
touch_points.clear();
}
+// static
WebView* EventSendingController::webview() {
return shell_->webView();
}
+// static
void EventSendingController::DoDragDrop(const WebKit::WebPoint &event_pos,
const WebDragData& drag_data,
WebDragOperationsMask mask) {
@@ -443,6 +451,7 @@ void EventSendingController::mouseUp(
}
}
+// static
void EventSendingController::DoMouseUp(const WebMouseEvent& e) {
webview()->handleInputEvent(e);
@@ -521,6 +530,7 @@ void EventSendingController::mouseWheelTo(
}
}
+// static
void EventSendingController::DoMouseMove(const WebMouseEvent& e) {
last_mouse_pos_.SetPoint(e.x, e.y);
diff --git a/webkit/tools/test_shell/event_sending_controller.h b/webkit/tools/test_shell/event_sending_controller.h
index da7e4df..4c3c9f2 100644
--- a/webkit/tools/test_shell/event_sending_controller.h
+++ b/webkit/tools/test_shell/event_sending_controller.h
@@ -41,9 +41,9 @@ class EventSendingController : public CppBoundClass {
void Reset();
// Simulate drag&drop system call.
- void DoDragDrop(const WebKit::WebPoint &event_pos,
- const WebKit::WebDragData& drag_data,
- WebKit::WebDragOperationsMask operations_mask);
+ static void DoDragDrop(const WebKit::WebPoint &event_pos,
+ const WebKit::WebDragData& drag_data,
+ WebKit::WebDragOperationsMask operations_mask);
// JS callback methods.
void mouseDown(const CppArgumentList& args, CppVariant* result);
@@ -93,17 +93,17 @@ class EventSendingController : public CppBoundClass {
private:
// Returns the test shell's webview.
- WebKit::WebView* webview();
+ static WebKit::WebView* webview();
// Returns true if dragMode is true.
bool drag_mode() { return dragMode.isBool() && dragMode.ToBoolean(); }
// Sometimes we queue up mouse move and mouse up events for drag drop
// handling purposes. These methods dispatch the event.
- void DoMouseMove(const WebKit::WebMouseEvent& e);
- void DoMouseUp(const WebKit::WebMouseEvent& e);
+ static void DoMouseMove(const WebKit::WebMouseEvent& e);
+ static void DoMouseUp(const WebKit::WebMouseEvent& e);
static void DoLeapForward(int milliseconds);
- void ReplaySavedEvents();
+ static void ReplaySavedEvents();
// Helper to return the button type given a button code
static WebKit::WebMouseEvent::Button GetButtonTypeFromButtonNumber(
@@ -125,7 +125,7 @@ class EventSendingController : public CppBoundClass {
ScopedRunnableMethodFactory<EventSendingController> method_factory_;
// Non-owning pointer. The LayoutTestController is owned by the host.
- TestShell* shell_;
+ static TestShell* shell_;
// Location of last mouseMoveTo event.
static gfx::Point last_mouse_pos_;
diff --git a/webkit/tools/test_shell/test_shell.h b/webkit/tools/test_shell/test_shell.h
index 9595a47..10f6371 100644
--- a/webkit/tools/test_shell/test_shell.h
+++ b/webkit/tools/test_shell/test_shell.h
@@ -156,9 +156,6 @@ public:
TestNavigationController* navigation_controller() {
return navigation_controller_.get();
}
- EventSendingController* event_sending_controller() {
- return event_sending_controller_.get();
- }
// Resets the LayoutTestController and EventSendingController. Should be
// called before loading a page, since some end-editing event notifications
diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc
index 8d7f8ec7..8ce1bcb 100644
--- a/webkit/tools/test_shell/test_shell_win.cc
+++ b/webkit/tools/test_shell/test_shell_win.cc
@@ -275,17 +275,13 @@ bool TestShell::RunFileTest(const TestParams& params) {
if (inspector_test_mode_)
shell->ShowDevTools();
- GURL url(params.test_url);
- if (url.is_valid()) { // Don't hang if we have an invalid path.
- shell->test_is_preparing_ = true;
- shell->set_test_params(&params);
- shell->LoadURL(url);
- shell->test_is_preparing_ = false;
- shell->WaitTestFinished();
- shell->set_test_params(NULL);
- } else {
- NOTREACHED() << "Invalid url: " << url.spec();
- }
+ shell->test_is_preparing_ = true;
+ shell->set_test_params(&params);
+ shell->LoadURL(GURL(params.test_url));
+
+ shell->test_is_preparing_ = false;
+ shell->WaitTestFinished();
+ shell->set_test_params(NULL);
return true;
}
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 5a1f2e4..a03569c 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -558,8 +558,7 @@ void TestWebViewDelegate::startDragging(
// When running a test, we need to fake a drag drop operation otherwise
// Windows waits for real mouse events to know when the drag is over.
- shell_->event_sending_controller()->DoDragDrop(
- mouse_coords, mutable_drag_data, mask);
+ EventSendingController::DoDragDrop(mouse_coords, mutable_drag_data, mask);
} else {
// TODO(tc): Drag and drop is disabled in the test shell because we need
// to be able to convert from WebDragData to an IDataObject.