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

Side by Side Diff: Source/web/tests/WebPluginContainerTest.cpp

Issue 1311233004: Cleanup IsKeyPad and IsAutoRepeat in PlatformKeyboardEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 | « Source/web/WebInputEventConversion.cpp ('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 * 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 webView->settings()->setPluginsEnabled(true); 264 webView->settings()->setPluginsEnabled(true);
265 webView->resize(WebSize(300, 300)); 265 webView->resize(WebSize(300, 300));
266 webView->layout(); 266 webView->layout();
267 runPendingTasks(); 267 runPendingTasks();
268 268
269 WebElement pluginContainerOneElement = webView->mainFrame()->document().getE lementById(WebString::fromUTF8("translated-plugin")); 269 WebElement pluginContainerOneElement = webView->mainFrame()->document().getE lementById(WebString::fromUTF8("translated-plugin"));
270 PlatformEvent::Modifiers modifierKey = PlatformEvent::CtrlKey; 270 PlatformEvent::Modifiers modifierKey = PlatformEvent::CtrlKey;
271 #if OS(MACOSX) 271 #if OS(MACOSX)
272 modifierKey = PlatformEvent::MetaKey; 272 modifierKey = PlatformEvent::MetaKey;
273 #endif 273 #endif
274 PlatformKeyboardEvent platformKeyboardEventC(PlatformEvent::RawKeyDown, "", "", "67", "", "", 67, 0, false, false, false, modifierKey, 0.0); 274 PlatformKeyboardEvent platformKeyboardEventC(PlatformEvent::RawKeyDown, "", "", "67", "", "", 67, 0, false, modifierKey, 0.0);
275 RefPtrWillBeRawPtr<KeyboardEvent> keyEventC = KeyboardEvent::create(platform KeyboardEventC, 0); 275 RefPtrWillBeRawPtr<KeyboardEvent> keyEventC = KeyboardEvent::create(platform KeyboardEventC, 0);
276 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl eEvent(keyEventC.get()); 276 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl eEvent(keyEventC.get());
277 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We bClipboard::Buffer())); 277 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We bClipboard::Buffer()));
278 278
279 // Clearing |Clipboard::Buffer()|. 279 // Clearing |Clipboard::Buffer()|.
280 Platform::current()->clipboard()->writePlainText(WebString("")); 280 Platform::current()->clipboard()->writePlainText(WebString(""));
281 EXPECT_EQ(WebString(""), Platform::current()->clipboard()->readPlainText(Web Clipboard::Buffer())); 281 EXPECT_EQ(WebString(""), Platform::current()->clipboard()->readPlainText(Web Clipboard::Buffer()));
282 282
283 PlatformKeyboardEvent platformKeyboardEventInsert(PlatformEvent::RawKeyDown, "", "", "45", "", "", 45, 0, false, false, false, modifierKey, 0.0); 283 PlatformKeyboardEvent platformKeyboardEventInsert(PlatformEvent::RawKeyDown, "", "", "45", "", "", 45, 0, false, modifierKey, 0.0);
284 RefPtrWillBeRawPtr<KeyboardEvent> keyEventInsert = KeyboardEvent::create(pla tformKeyboardEventInsert, 0); 284 RefPtrWillBeRawPtr<KeyboardEvent> keyEventInsert = KeyboardEvent::create(pla tformKeyboardEventInsert, 0);
285 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl eEvent(keyEventInsert.get()); 285 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl eEvent(keyEventInsert.get());
286 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We bClipboard::Buffer())); 286 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We bClipboard::Buffer()));
287 } 287 }
288 288
289 // A class to facilitate testing that events are correctly received by plugins. 289 // A class to facilitate testing that events are correctly received by plugins.
290 class EventTestPlugin : public FakeWebPlugin { 290 class EventTestPlugin : public FakeWebPlugin {
291 public: 291 public:
292 EventTestPlugin(WebFrame* frame, const WebPluginParams& params) 292 EventTestPlugin(WebFrame* frame, const WebPluginParams& params)
293 : FakeWebPlugin(frame, params) 293 : FakeWebPlugin(frame, params)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 TopmostPlugin* testPlugin = static_cast<TopmostPlugin*>(pluginContainerImpl- >plugin()); 429 TopmostPlugin* testPlugin = static_cast<TopmostPlugin*>(pluginContainerImpl- >plugin());
430 EXPECT_TRUE(testPlugin->isRectTopmost()); 430 EXPECT_TRUE(testPlugin->isRectTopmost());
431 431
432 // Cause the plugin's frame to be detached. 432 // Cause the plugin's frame to be detached.
433 webViewHelper.reset(); 433 webViewHelper.reset();
434 434
435 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(topmostRect)); 435 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(topmostRect));
436 } 436 }
437 437
438 } // namespace blink 438 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebInputEventConversion.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698