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

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

Issue 933323002: Add experimental Support for DOM3 KeyboardEvent key value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated global-interface-listing as test were failing due to addition of the key Created 5 years, 7 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
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 webView->settings()->setPluginsEnabled(true); 194 webView->settings()->setPluginsEnabled(true);
195 webView->resize(WebSize(300, 300)); 195 webView->resize(WebSize(300, 300));
196 webView->layout(); 196 webView->layout();
197 runPendingTasks(); 197 runPendingTasks();
198 198
199 WebElement pluginContainerOneElement = webView->mainFrame()->document().getE lementById(WebString::fromUTF8("translated-plugin")); 199 WebElement pluginContainerOneElement = webView->mainFrame()->document().getE lementById(WebString::fromUTF8("translated-plugin"));
200 PlatformEvent::Modifiers modifierKey = PlatformEvent::CtrlKey; 200 PlatformEvent::Modifiers modifierKey = PlatformEvent::CtrlKey;
201 #if OS(MACOSX) 201 #if OS(MACOSX)
202 modifierKey = PlatformEvent::MetaKey; 202 modifierKey = PlatformEvent::MetaKey;
203 #endif 203 #endif
204 PlatformKeyboardEvent platformKeyboardEventC(PlatformEvent::RawKeyDown, "", "", "67", "", 67, 0, false, false, false, modifierKey, 0.0); 204 PlatformKeyboardEvent platformKeyboardEventC(PlatformEvent::RawKeyDown, "", "", "67", "", "", 67, 0, false, false, false, modifierKey, 0.0);
205 RefPtrWillBeRawPtr<KeyboardEvent> keyEventC = KeyboardEvent::create(platform KeyboardEventC, 0); 205 RefPtrWillBeRawPtr<KeyboardEvent> keyEventC = KeyboardEvent::create(platform KeyboardEventC, 0);
206 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl eEvent(keyEventC.get()); 206 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl eEvent(keyEventC.get());
207 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We bClipboard::Buffer())); 207 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We bClipboard::Buffer()));
208 208
209 // Clearing |Clipboard::Buffer()|. 209 // Clearing |Clipboard::Buffer()|.
210 Platform::current()->clipboard()->writePlainText(WebString("")); 210 Platform::current()->clipboard()->writePlainText(WebString(""));
211 EXPECT_EQ(WebString(""), Platform::current()->clipboard()->readPlainText(Web Clipboard::Buffer())); 211 EXPECT_EQ(WebString(""), Platform::current()->clipboard()->readPlainText(Web Clipboard::Buffer()));
212 212
213 PlatformKeyboardEvent platformKeyboardEventInsert(PlatformEvent::RawKeyDown, "", "", "45", "", 45, 0, false, false, false, modifierKey, 0.0); 213 PlatformKeyboardEvent platformKeyboardEventInsert(PlatformEvent::RawKeyDown, "", "", "45", "", "", 45, 0, false, false, false, modifierKey, 0.0);
214 RefPtrWillBeRawPtr<KeyboardEvent> keyEventInsert = KeyboardEvent::create(pla tformKeyboardEventInsert, 0); 214 RefPtrWillBeRawPtr<KeyboardEvent> keyEventInsert = KeyboardEvent::create(pla tformKeyboardEventInsert, 0);
215 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl eEvent(keyEventInsert.get()); 215 toWebPluginContainerImpl(pluginContainerOneElement.pluginContainer())->handl eEvent(keyEventInsert.get());
216 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We bClipboard::Buffer())); 216 EXPECT_EQ(WebString("x"), Platform::current()->clipboard()->readPlainText(We bClipboard::Buffer()));
217 } 217 }
218 218
219 // A class to facilitate testing that events are correctly received by plugins. 219 // A class to facilitate testing that events are correctly received by plugins.
220 class EventTestPlugin : public FakeWebPlugin { 220 class EventTestPlugin : public FakeWebPlugin {
221 public: 221 public:
222 EventTestPlugin(WebFrame* frame, const WebPluginParams& params) 222 EventTestPlugin(WebFrame* frame, const WebPluginParams& params)
223 : FakeWebPlugin(frame, params) 223 : FakeWebPlugin(frame, params)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 WebRect rect = pluginContainerImpl->element().boundsInViewportSpace(); 305 WebRect rect = pluginContainerImpl->element().boundsInViewportSpace();
306 EXPECT_TRUE(pluginContainerImpl->isRectTopmost(rect)); 306 EXPECT_TRUE(pluginContainerImpl->isRectTopmost(rect));
307 307
308 // Cause the plugin's frame to be detached. 308 // Cause the plugin's frame to be detached.
309 webViewHelper.reset(); 309 webViewHelper.reset();
310 310
311 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(rect)); 311 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(rect));
312 } 312 }
313 } 313 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698