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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) |
294 , m_lastEventType(WebInputEvent::Undefined) | 294 , m_lastEventType(WebInputEvent::Undefined) |
295 { | 295 { |
296 } | 296 } |
297 | 297 |
298 virtual bool handleInputEvent(const WebInputEvent& event, WebCursorInfo&) ov
erride | 298 bool handleInputEvent(const WebInputEvent& event, WebCursorInfo&) override |
299 { | 299 { |
300 m_lastEventType = event.type; | 300 m_lastEventType = event.type; |
301 return true; | 301 return true; |
302 } | 302 } |
303 WebInputEvent::Type getLastInputEventType() {return m_lastEventType; } | 303 WebInputEvent::Type getLastInputEventType() {return m_lastEventType; } |
304 | 304 |
305 private: | 305 private: |
306 WebInputEvent::Type m_lastEventType; | 306 WebInputEvent::Type m_lastEventType; |
307 }; | 307 }; |
308 | 308 |
309 class EventTestPluginWebFrameClient : public FrameTestHelpers::TestWebFrameClien
t { | 309 class EventTestPluginWebFrameClient : public FrameTestHelpers::TestWebFrameClien
t { |
310 virtual WebPlugin* createPlugin(WebLocalFrame* frame, const WebPluginParams&
params) override | 310 WebPlugin* createPlugin(WebLocalFrame* frame, const WebPluginParams& params)
override |
311 { | 311 { |
312 if (params.mimeType == WebString::fromUTF8("application/x-webkit-test-we
bplugin")) | 312 if (params.mimeType == WebString::fromUTF8("application/x-webkit-test-we
bplugin")) |
313 return new EventTestPlugin(frame, params); | 313 return new EventTestPlugin(frame, params); |
314 return WebFrameClient::createPlugin(frame, params); | 314 return WebFrameClient::createPlugin(frame, params); |
315 } | 315 } |
316 }; | 316 }; |
317 | 317 |
318 TEST_F(WebPluginContainerTest, GestureLongPressReachesPlugin) | 318 TEST_F(WebPluginContainerTest, GestureLongPressReachesPlugin) |
319 { | 319 { |
320 URLTestHelpers::registerMockedURLFromBaseURL( | 320 URLTestHelpers::registerMockedURLFromBaseURL( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 WebRect rect = pluginContainerImpl->element().boundsInViewportSpace(); | 375 WebRect rect = pluginContainerImpl->element().boundsInViewportSpace(); |
376 EXPECT_TRUE(pluginContainerImpl->isRectTopmost(rect)); | 376 EXPECT_TRUE(pluginContainerImpl->isRectTopmost(rect)); |
377 | 377 |
378 // Cause the plugin's frame to be detached. | 378 // Cause the plugin's frame to be detached. |
379 webViewHelper.reset(); | 379 webViewHelper.reset(); |
380 | 380 |
381 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(rect)); | 381 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(rect)); |
382 } | 382 } |
383 | 383 |
384 } // namespace blink | 384 } // namespace blink |
OLD | NEW |