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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 webView->settings()->setPluginsEnabled(true); | 367 webView->settings()->setPluginsEnabled(true); |
368 webView->resize(WebSize(300, 300)); | 368 webView->resize(WebSize(300, 300)); |
369 webView->updateAllLifecyclePhases(); | 369 webView->updateAllLifecyclePhases(); |
370 runPendingTasks(); | 370 runPendingTasks(); |
371 | 371 |
372 WebElement pluginContainerOneElement = webView->mainFrame()->document().getE
lementById(WebString::fromUTF8("translated-plugin")); | 372 WebElement pluginContainerOneElement = webView->mainFrame()->document().getE
lementById(WebString::fromUTF8("translated-plugin")); |
373 PlatformEvent::Modifiers modifierKey = static_cast<PlatformEvent::Modifiers>
(PlatformEvent::CtrlKey | PlatformEvent::NumLockOn | PlatformEvent::IsLeft); | 373 PlatformEvent::Modifiers modifierKey = static_cast<PlatformEvent::Modifiers>
(PlatformEvent::CtrlKey | PlatformEvent::NumLockOn | PlatformEvent::IsLeft); |
374 #if OS(MACOSX) | 374 #if OS(MACOSX) |
375 modifierKey = static_cast<PlatformEvent::Modifiers>(PlatformEvent::MetaKey |
PlatformEvent::NumLockOn | PlatformEvent::IsLeft); | 375 modifierKey = static_cast<PlatformEvent::Modifiers>(PlatformEvent::MetaKey |
PlatformEvent::NumLockOn | PlatformEvent::IsLeft); |
376 #endif | 376 #endif |
377 PlatformKeyboardEvent platformKeyboardEventC(PlatformEvent::RawKeyDown, "",
"", "67", "", "", 67, 0, false, modifierKey, 0.0); | 377 PlatformKeyboardEvent platformKeyboardEventC(PlatformEvent::RawKeyDown, "",
"", "", "", 67, 0, false, modifierKey, 0.0); |
378 KeyboardEvent* keyEventC = KeyboardEvent::create(platformKeyboardEventC, 0); | 378 KeyboardEvent* keyEventC = KeyboardEvent::create(platformKeyboardEventC, 0); |
379 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl
eEvent(keyEventC); | 379 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl
eEvent(keyEventC); |
380 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We
bClipboard::Buffer())); | 380 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We
bClipboard::Buffer())); |
381 | 381 |
382 // Clearing |Clipboard::Buffer()|. | 382 // Clearing |Clipboard::Buffer()|. |
383 Platform::current()->clipboard()->writePlainText(WebString("")); | 383 Platform::current()->clipboard()->writePlainText(WebString("")); |
384 EXPECT_EQ(WebString(""), Platform::current()->clipboard()->readPlainText(Web
Clipboard::Buffer())); | 384 EXPECT_EQ(WebString(""), Platform::current()->clipboard()->readPlainText(Web
Clipboard::Buffer())); |
385 | 385 |
386 PlatformKeyboardEvent platformKeyboardEventInsert(PlatformEvent::RawKeyDown,
"", "", "45", "", "", 45, 0, false, modifierKey, 0.0); | 386 PlatformKeyboardEvent platformKeyboardEventInsert(PlatformEvent::RawKeyDown,
"", "", "", "", 45, 0, false, modifierKey, 0.0); |
387 KeyboardEvent* keyEventInsert = KeyboardEvent::create(platformKeyboardEventI
nsert, 0); | 387 KeyboardEvent* keyEventInsert = KeyboardEvent::create(platformKeyboardEventI
nsert, 0); |
388 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl
eEvent(keyEventInsert); | 388 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl
eEvent(keyEventInsert); |
389 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We
bClipboard::Buffer())); | 389 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We
bClipboard::Buffer())); |
390 } | 390 } |
391 | 391 |
392 // A class to facilitate testing that events are correctly received by plugins. | 392 // A class to facilitate testing that events are correctly received by plugins. |
393 class EventTestPlugin : public FakeWebPlugin { | 393 class EventTestPlugin : public FakeWebPlugin { |
394 public: | 394 public: |
395 EventTestPlugin(WebFrame* frame, const WebPluginParams& params) | 395 EventTestPlugin(WebFrame* frame, const WebPluginParams& params) |
396 : FakeWebPlugin(frame, params) | 396 : FakeWebPlugin(frame, params) |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 runPendingTasks(); | 686 runPendingTasks(); |
687 | 687 |
688 WebElement pluginContainerOneElement = webView->mainFrame()->document().getE
lementById(WebString::fromUTF8("translated-plugin")); | 688 WebElement pluginContainerOneElement = webView->mainFrame()->document().getE
lementById(WebString::fromUTF8("translated-plugin")); |
689 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true); | 689 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true); |
690 | 690 |
691 runPendingTasks(); | 691 runPendingTasks(); |
692 EXPECT_TRUE(webView->page()->frameHost().eventHandlerRegistry().hasEventHand
lers(EventHandlerRegistry::WheelEventBlocking)); | 692 EXPECT_TRUE(webView->page()->frameHost().eventHandlerRegistry().hasEventHand
lers(EventHandlerRegistry::WheelEventBlocking)); |
693 } | 693 } |
694 | 694 |
695 } // namespace blink | 695 } // namespace blink |
OLD | NEW |