diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 21:49:14 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-16 21:49:14 +0000 |
commit | 7699d05e38e2e4e26add3357151e0fd793080353 (patch) | |
tree | b0dad38807b641c80089efc9e45af76974068037 /webkit/tools/npapi_layout_test_plugin | |
parent | 4c2464b49571049ad7128343bfafa9abb3be7e0c (diff) | |
download | chromium_src-7699d05e38e2e4e26add3357151e0fd793080353.zip chromium_src-7699d05e38e2e4e26add3357151e0fd793080353.tar.gz chromium_src-7699d05e38e2e4e26add3357151e0fd793080353.tar.bz2 |
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/keyboard-events.html on Windows.
Review URL: http://codereview.chromium.org/1011005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/npapi_layout_test_plugin')
-rw-r--r-- | webkit/tools/npapi_layout_test_plugin/PluginObject.cpp | 1 | ||||
-rw-r--r-- | webkit/tools/npapi_layout_test_plugin/PluginObject.h | 1 | ||||
-rw-r--r-- | webkit/tools/npapi_layout_test_plugin/main.cpp | 24 |
3 files changed, 17 insertions, 9 deletions
diff --git a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp index 4b310ef..026d74f 100644 --- a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp +++ b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp @@ -982,6 +982,7 @@ 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 5cab228..8cd63ef 100644 --- a/webkit/tools/npapi_layout_test_plugin/PluginObject.h +++ b/webkit/tools/npapi_layout_test_plugin/PluginObject.h @@ -38,6 +38,7 @@ 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 a644d03..9ff3ebb 100644 --- a/webkit/tools/npapi_layout_test_plugin/main.cpp +++ b/webkit/tools/npapi_layout_test_plugin/main.cpp @@ -140,7 +140,8 @@ 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; @@ -182,13 +183,18 @@ 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; @@ -292,17 +298,17 @@ int16 NPP_HandleEvent(NPP instance, void *event) case WM_RBUTTONDBLCLK: break; case WM_MOUSEMOVE: - log(instance, "adjustCursorEvent"); break; case WM_KEYUP: - // TODO(tc): We need to convert evt->wParam from virtual-key code - // to key code. - log(instance, "NOTIMPLEMENTED: keyUp '%c'", ' '); + log(instance, "keyUp '%c'", MapVirtualKey(evt->wParam, MAPVK_VK_TO_CHAR)); + if (obj->testKeyboardFocusForPlugins) { + obj->eventLogging = false; + obj->testKeyboardFocusForPlugins = FALSE; + executeScript(obj, "layoutTestController.notifyDone();"); + } break; case WM_KEYDOWN: - // TODO(tc): We need to convert evt->wParam from virtual-key code - // to key code. - log(instance, "NOTIMPLEMENTED: keyDown '%c'", ' '); + log(instance, "keyDown '%c'", MapVirtualKey(evt->wParam, MAPVK_VK_TO_CHAR)); break; case WM_SETCURSOR: break; |