| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 webView->mainFrame()->document().getElementById( | 412 webView->mainFrame()->document().getElementById( |
| 413 WebString::fromUTF8("translated-plugin")); | 413 WebString::fromUTF8("translated-plugin")); |
| 414 WebInputEvent::Modifiers modifierKey = static_cast<WebInputEvent::Modifiers>( | 414 WebInputEvent::Modifiers modifierKey = static_cast<WebInputEvent::Modifiers>( |
| 415 WebInputEvent::ControlKey | WebInputEvent::NumLockOn | | 415 WebInputEvent::ControlKey | WebInputEvent::NumLockOn | |
| 416 WebInputEvent::IsLeft); | 416 WebInputEvent::IsLeft); |
| 417 #if OS(MACOSX) | 417 #if OS(MACOSX) |
| 418 modifierKey = static_cast<WebInputEvent::Modifiers>(WebInputEvent::MetaKey | | 418 modifierKey = static_cast<WebInputEvent::Modifiers>(WebInputEvent::MetaKey | |
| 419 WebInputEvent::NumLockOn | | 419 WebInputEvent::NumLockOn | |
| 420 WebInputEvent::IsLeft); | 420 WebInputEvent::IsLeft); |
| 421 #endif | 421 #endif |
| 422 WebKeyboardEvent webKeyboardEventC; | 422 WebKeyboardEvent webKeyboardEventC(WebInputEvent::RawKeyDown, modifierKey, |
| 423 webKeyboardEventC.type = WebInputEvent::RawKeyDown; | 423 WebInputEvent::TimeStampForTesting); |
| 424 webKeyboardEventC.modifiers = modifierKey; | |
| 425 webKeyboardEventC.windowsKeyCode = 67; | 424 webKeyboardEventC.windowsKeyCode = 67; |
| 426 KeyboardEvent* keyEventC = KeyboardEvent::create(webKeyboardEventC, 0); | 425 KeyboardEvent* keyEventC = KeyboardEvent::create(webKeyboardEventC, 0); |
| 427 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer()) | 426 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer()) |
| 428 ->handleEvent(keyEventC); | 427 ->handleEvent(keyEventC); |
| 429 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText( | 428 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText( |
| 430 WebClipboard::Buffer())); | 429 WebClipboard::Buffer())); |
| 431 | 430 |
| 432 // Clearing |Clipboard::Buffer()|. | 431 // Clearing |Clipboard::Buffer()|. |
| 433 Platform::current()->clipboard()->writePlainText(WebString("")); | 432 Platform::current()->clipboard()->writePlainText(WebString("")); |
| 434 EXPECT_EQ(WebString(""), Platform::current()->clipboard()->readPlainText( | 433 EXPECT_EQ(WebString(""), Platform::current()->clipboard()->readPlainText( |
| 435 WebClipboard::Buffer())); | 434 WebClipboard::Buffer())); |
| 436 | 435 |
| 437 WebKeyboardEvent webKeyboardEventInsert; | 436 WebKeyboardEvent webKeyboardEventInsert(WebInputEvent::RawKeyDown, |
| 438 webKeyboardEventInsert.type = WebInputEvent::RawKeyDown; | 437 modifierKey, |
| 439 webKeyboardEventInsert.modifiers = modifierKey; | 438 WebInputEvent::TimeStampForTesting); |
| 440 webKeyboardEventInsert.windowsKeyCode = 45; | 439 webKeyboardEventInsert.windowsKeyCode = 45; |
| 441 KeyboardEvent* keyEventInsert = | 440 KeyboardEvent* keyEventInsert = |
| 442 KeyboardEvent::create(webKeyboardEventInsert, 0); | 441 KeyboardEvent::create(webKeyboardEventInsert, 0); |
| 443 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer()) | 442 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer()) |
| 444 ->handleEvent(keyEventInsert); | 443 ->handleEvent(keyEventInsert); |
| 445 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText( | 444 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText( |
| 446 WebClipboard::Buffer())); | 445 WebClipboard::Buffer())); |
| 447 } | 446 } |
| 448 | 447 |
| 449 // A class to facilitate testing that events are correctly received by plugins. | 448 // A class to facilitate testing that events are correctly received by plugins. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 480 runPendingTasks(); | 479 runPendingTasks(); |
| 481 | 480 |
| 482 WebElement pluginContainerOneElement = | 481 WebElement pluginContainerOneElement = |
| 483 webView->mainFrame()->document().getElementById( | 482 webView->mainFrame()->document().getElementById( |
| 484 WebString::fromUTF8("translated-plugin")); | 483 WebString::fromUTF8("translated-plugin")); |
| 485 WebPlugin* plugin = static_cast<WebPluginContainerImpl*>( | 484 WebPlugin* plugin = static_cast<WebPluginContainerImpl*>( |
| 486 pluginContainerOneElement.pluginContainer()) | 485 pluginContainerOneElement.pluginContainer()) |
| 487 ->plugin(); | 486 ->plugin(); |
| 488 EventTestPlugin* testPlugin = static_cast<EventTestPlugin*>(plugin); | 487 EventTestPlugin* testPlugin = static_cast<EventTestPlugin*>(plugin); |
| 489 | 488 |
| 490 WebGestureEvent event; | 489 WebGestureEvent event(WebInputEvent::GestureLongPress, |
| 491 event.type = WebInputEvent::GestureLongPress; | 490 WebInputEvent::NoModifiers, |
| 491 WebInputEvent::TimeStampForTesting); |
| 492 event.sourceDevice = WebGestureDeviceTouchscreen; | 492 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 493 | 493 |
| 494 // First, send an event that doesn't hit the plugin to verify that the | 494 // First, send an event that doesn't hit the plugin to verify that the |
| 495 // plugin doesn't receive it. | 495 // plugin doesn't receive it. |
| 496 event.x = 0; | 496 event.x = 0; |
| 497 event.y = 0; | 497 event.y = 0; |
| 498 | 498 |
| 499 webView->handleInputEvent(event); | 499 webView->handleInputEvent(event); |
| 500 runPendingTasks(); | 500 runPendingTasks(); |
| 501 | 501 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 WebString::fromUTF8("translated-plugin")); | 773 WebString::fromUTF8("translated-plugin")); |
| 774 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true); | 774 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true); |
| 775 | 775 |
| 776 runPendingTasks(); | 776 runPendingTasks(); |
| 777 EXPECT_TRUE( | 777 EXPECT_TRUE( |
| 778 webView->page()->frameHost().eventHandlerRegistry().hasEventHandlers( | 778 webView->page()->frameHost().eventHandlerRegistry().hasEventHandlers( |
| 779 EventHandlerRegistry::WheelEventBlocking)); | 779 EventHandlerRegistry::WheelEventBlocking)); |
| 780 } | 780 } |
| 781 | 781 |
| 782 } // namespace blink | 782 } // namespace blink |
| OLD | NEW |