Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: webkit/tools/npapi_layout_test_plugin/main.cpp

Issue 155036: linux: re-enable test plugin code for X events (Closed)
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webkit/tools/layout_tests/test_expectations.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Ap ple") in 2 IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Ap ple") in
3 consideration of your agreement to the following terms, and your use, installat ion, 3 consideration of your agreement to the following terms, and your use, installat ion,
4 modification or redistribution of this Apple software constitutes acceptance of these 4 modification or redistribution of this Apple software constitutes acceptance of these
5 terms. If you do not agree with these terms, please do not use, install, modif y or 5 terms. If you do not agree with these terms, please do not use, install, modif y or
6 redistribute this Apple software. 6 redistribute this Apple software.
7 7
8 In consideration of your agreement to abide by the following terms, and subject to these 8 In consideration of your agreement to abide by the following terms, and subject to these
9 terms, Apple grants you a personal, non-exclusive license, under Apple’s copyri ghts in 9 terms, Apple grants you a personal, non-exclusive license, under Apple’s copyri ghts in
10 this original Apple software (the "Apple Software"), to use, reproduce, modify and 10 this original Apple software (the "Apple Software"), to use, reproduce, modify and
(...skipping 16 matching lines...) Expand all
27 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERV ICES; LOSS 27 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERV ICES; LOSS
28 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, 28 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
29 REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER C AUSED AND 29 REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER C AUSED AND
30 WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR 30 WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
31 OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34 #include <stdlib.h> 34 #include <stdlib.h>
35 #include <stdio.h> 35 #include <stdio.h>
36 #include <wtf/Platform.h> 36 #include <wtf/Platform.h>
37 // The buildbot doesn't have Xlib. Rather than revert this, I've just
38 // temporarily ifdef'd it out.
39 #ifdef XLIB_TEMPORARILY_DISABLED
40 #if PLATFORM(UNIX)
41 #include <X11/Xlib.h>
42 #endif
43 #endif
44 #include "PluginObject.h" 37 #include "PluginObject.h"
45 38
46 #ifdef WIN32 39 #ifdef WIN32
47 #define strcasecmp _stricmp 40 #define strcasecmp _stricmp
48 #define NPAPI WINAPI 41 #define NPAPI WINAPI
49 #else 42 #else
50 #define NPAPI 43 #define NPAPI
51 #endif 44 #endif
52 45
46 #if defined(OS_LINUX)
47 #include <X11/Xlib.h>
48 #endif
49
53 static void log(NPP instance, const char* format, ...) 50 static void log(NPP instance, const char* format, ...)
54 { 51 {
55 va_list args; 52 va_list args;
56 va_start(args, format); 53 va_start(args, format);
57 char message[2048] = "PLUGIN: "; 54 char message[2048] = "PLUGIN: ";
58 vsprintf(message + strlen(message), format, args); 55 vsprintf(message + strlen(message), format, args);
59 va_end(args); 56 va_end(args);
60 57
61 NPObject* windowObject = 0; 58 NPObject* windowObject = 0;
62 NPError error = browser->getvalue(instance, NPNVWindowNPObject, &windowObjec t); 59 NPError error = browser->getvalue(instance, NPNVWindowNPObject, &windowObjec t);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 break; 325 break;
329 case WM_KILLFOCUS: 326 case WM_KILLFOCUS:
330 log(instance, "loseFocusEvent"); 327 log(instance, "loseFocusEvent");
331 break; 328 break;
332 default: 329 default:
333 log(instance, "event %d", evt->event); 330 log(instance, "event %d", evt->event);
334 } 331 }
335 332
336 fflush(stdout); 333 fflush(stdout);
337 334
338 #elif PLATFORM(UNIX) 335 #elif defined(OS_LINUX)
339 #ifdef XLIB_TEMPORARILY_DISABLED
340 XEvent* evt = static_cast<XEvent*>(event); 336 XEvent* evt = static_cast<XEvent*>(event);
341 XButtonPressedEvent* bpress_evt = reinterpret_cast<XButtonPressedEvent*>(evt ); 337 XButtonPressedEvent* bpress_evt = reinterpret_cast<XButtonPressedEvent*>(evt );
342 XButtonReleasedEvent* brelease_evt = reinterpret_cast<XButtonReleasedEvent*> (evt); 338 XButtonReleasedEvent* brelease_evt = reinterpret_cast<XButtonReleasedEvent*> (evt);
343 switch (evt->type) { 339 switch (evt->type) {
344 case ButtonPress: 340 case ButtonPress:
345 log(instance, "mouseDown at (%d, %d)", bpress_evt->x, bpress_evt->y) ; 341 log(instance, "mouseDown at (%d, %d)", bpress_evt->x, bpress_evt->y) ;
346 break; 342 break;
347 case ButtonRelease: 343 case ButtonRelease:
348 log(instance, "mouseUp at (%d, %d)", brelease_evt->x, brelease_evt-> y); 344 log(instance, "mouseUp at (%d, %d)", brelease_evt->x, brelease_evt-> y);
349 break; 345 break;
(...skipping 18 matching lines...) Expand all
368 case EnterNotify: 364 case EnterNotify:
369 case LeaveNotify: 365 case LeaveNotify:
370 case MotionNotify: 366 case MotionNotify:
371 log(instance, "adjustCursorEvent"); 367 log(instance, "adjustCursorEvent");
372 break; 368 break;
373 default: 369 default:
374 log(instance, "event %d", evt->type); 370 log(instance, "event %d", evt->type);
375 } 371 }
376 372
377 fflush(stdout); 373 fflush(stdout);
378 #endif // XLIB_TEMPORARILY_DISABLED
379
380 #else 374 #else
381 EventRecord* evt = static_cast<EventRecord*>(event); 375 EventRecord* evt = static_cast<EventRecord*>(event);
382 Point pt = { evt->where.v, evt->where.h }; 376 Point pt = { evt->where.v, evt->where.h };
383 switch (evt->what) { 377 switch (evt->what) {
384 case nullEvent: 378 case nullEvent:
385 // these are delivered non-deterministically, don't log. 379 // these are delivered non-deterministically, don't log.
386 break; 380 break;
387 case mouseDown: 381 case mouseDown:
388 GlobalToLocal(&pt); 382 GlobalToLocal(&pt);
389 log(instance, "mouseDown at (%d, %d)", pt.h, pt.v); 383 log(instance, "mouseDown at (%d, %d)", pt.h, pt.v);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 const char* NP_GetMIMEDescription(void) { 493 const char* NP_GetMIMEDescription(void) {
500 // The layout test LayoutTests/fast/js/navigator-mimeTypes-length.html 494 // The layout test LayoutTests/fast/js/navigator-mimeTypes-length.html
501 // asserts that the number of mimetypes handled by plugins should be 495 // asserts that the number of mimetypes handled by plugins should be
502 // greater than the number of plugins. This isn't true if we're 496 // greater than the number of plugins. This isn't true if we're
503 // the only plugin and we only handle one mimetype, so specify 497 // the only plugin and we only handle one mimetype, so specify
504 // multiple mimetypes here. 498 // multiple mimetypes here.
505 return "application/x-webkit-test-netscape:testnetscape:test netscape conten t;" 499 return "application/x-webkit-test-netscape:testnetscape:test netscape conten t;"
506 "application/x-webkit-test-netscape2:testnetscape2:test netscape cont ent2"; 500 "application/x-webkit-test-netscape2:testnetscape2:test netscape cont ent2";
507 } 501 }
508 #endif 502 #endif
OLDNEW
« no previous file with comments | « webkit/tools/layout_tests/test_expectations.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698