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

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

Issue 1463723003: Return VisualViewport coords in boundsInViewportSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // plugin doesn't receive it. 361 // plugin doesn't receive it.
362 event.x = 0; 362 event.x = 0;
363 event.y = 0; 363 event.y = 0;
364 364
365 webView->handleInputEvent(event); 365 webView->handleInputEvent(event);
366 runPendingTasks(); 366 runPendingTasks();
367 367
368 EXPECT_EQ(WebInputEvent::Undefined, testPlugin->getLastInputEventType()); 368 EXPECT_EQ(WebInputEvent::Undefined, testPlugin->getLastInputEventType());
369 369
370 // Next, send an event that does hit the plugin, and verify it does receive it. 370 // Next, send an event that does hit the plugin, and verify it does receive it.
371 WebRect rect = pluginContainerOneElement.boundsInViewportSpace(); 371 WebRect rect = pluginContainerOneElement.boundsInViewport();
372 event.x = rect.x + rect.width / 2; 372 event.x = rect.x + rect.width / 2;
373 event.y = rect.y + rect.height / 2; 373 event.y = rect.y + rect.height / 2;
374 374
375 webView->handleInputEvent(event); 375 webView->handleInputEvent(event);
376 runPendingTasks(); 376 runPendingTasks();
377 377
378 EXPECT_EQ(WebInputEvent::GestureLongPress, testPlugin->getLastInputEventType ()); 378 EXPECT_EQ(WebInputEvent::GestureLongPress, testPlugin->getLastInputEventType ());
379 } 379 }
380 380
381 // Verify that isRectTopmost returns false when the document is detached. 381 // Verify that isRectTopmost returns false when the document is detached.
382 TEST_F(WebPluginContainerTest, IsRectTopmostTest) 382 TEST_F(WebPluginContainerTest, IsRectTopmostTest)
383 { 383 {
384 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("plugin_container.html")); 384 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("plugin_container.html"));
385 TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper . 385 TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper .
386 FrameTestHelpers::WebViewHelper webViewHelper; 386 FrameTestHelpers::WebViewHelper webViewHelper;
387 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_conta iner.html", true, &pluginWebFrameClient); 387 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_conta iner.html", true, &pluginWebFrameClient);
388 ASSERT(webView); 388 ASSERT(webView);
389 webView->settings()->setPluginsEnabled(true); 389 webView->settings()->setPluginsEnabled(true);
390 webView->resize(WebSize(300, 300)); 390 webView->resize(WebSize(300, 300));
391 webView->updateAllLifecyclePhases(); 391 webView->updateAllLifecyclePhases();
392 runPendingTasks(); 392 runPendingTasks();
393 393
394 RefPtrWillBeRawPtr<WebPluginContainerImpl> pluginContainerImpl = 394 RefPtrWillBeRawPtr<WebPluginContainerImpl> pluginContainerImpl =
395 toWebPluginContainerImpl(getWebPluginContainer(webView, WebString::fromU TF8("translated-plugin"))); 395 toWebPluginContainerImpl(getWebPluginContainer(webView, WebString::fromU TF8("translated-plugin")));
396 pluginContainerImpl->setFrameRect(IntRect(0, 0, 300, 300)); 396 pluginContainerImpl->setFrameRect(IntRect(0, 0, 300, 300));
397 397
398 WebRect rect = pluginContainerImpl->element().boundsInViewportSpace(); 398 WebRect rect = pluginContainerImpl->element().boundsInViewport();
399 EXPECT_TRUE(pluginContainerImpl->isRectTopmost(rect)); 399 EXPECT_TRUE(pluginContainerImpl->isRectTopmost(rect));
400 400
401 // Cause the plugin's frame to be detached. 401 // Cause the plugin's frame to be detached.
402 webViewHelper.reset(); 402 webViewHelper.reset();
403 403
404 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(rect)); 404 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(rect));
405 } 405 }
406 406
407 TEST_F(WebPluginContainerTest, TopmostAfterDetachTest) 407 TEST_F(WebPluginContainerTest, TopmostAfterDetachTest)
408 { 408 {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 TopmostPlugin* testPlugin = static_cast<TopmostPlugin*>(pluginContainerImpl- >plugin()); 453 TopmostPlugin* testPlugin = static_cast<TopmostPlugin*>(pluginContainerImpl- >plugin());
454 EXPECT_TRUE(testPlugin->isRectTopmost()); 454 EXPECT_TRUE(testPlugin->isRectTopmost());
455 455
456 // Cause the plugin's frame to be detached. 456 // Cause the plugin's frame to be detached.
457 webViewHelper.reset(); 457 webViewHelper.reset();
458 458
459 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(topmostRect)); 459 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(topmostRect));
460 } 460 }
461 461
462 } // namespace blink 462 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/WebFrameTest.cpp ('k') | third_party/WebKit/public/web/WebElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698