| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/events/KeyboardEvent.h" | 34 #include "core/events/KeyboardEvent.h" |
| 35 #include "core/frame/EventHandlerRegistry.h" | 35 #include "core/frame/EventHandlerRegistry.h" |
| 36 #include "core/frame/FrameHost.h" | 36 #include "core/frame/FrameHost.h" |
| 37 #include "core/layout/LayoutObject.h" | 37 #include "core/layout/LayoutObject.h" |
| 38 #include "core/page/Page.h" | 38 #include "core/page/Page.h" |
| 39 #include "platform/PlatformEvent.h" | 39 #include "platform/PlatformEvent.h" |
| 40 #include "platform/graphics/GraphicsContext.h" | 40 #include "platform/graphics/GraphicsContext.h" |
| 41 #include "platform/graphics/paint/CullRect.h" | 41 #include "platform/graphics/paint/CullRect.h" |
| 42 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" | 42 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" |
| 43 #include "platform/graphics/paint/PaintController.h" | 43 #include "platform/graphics/paint/PaintController.h" |
| 44 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
| 44 #include "platform/testing/URLTestHelpers.h" | 45 #include "platform/testing/URLTestHelpers.h" |
| 45 #include "platform/testing/UnitTestHelpers.h" | 46 #include "platform/testing/UnitTestHelpers.h" |
| 46 #include "public/platform/Platform.h" | 47 #include "public/platform/Platform.h" |
| 47 #include "public/platform/WebClipboard.h" | 48 #include "public/platform/WebClipboard.h" |
| 48 #include "public/platform/WebCompositorSupport.h" | 49 #include "public/platform/WebCompositorSupport.h" |
| 49 #include "public/platform/WebLayer.h" | 50 #include "public/platform/WebLayer.h" |
| 50 #include "public/platform/WebThread.h" | 51 #include "public/platform/WebThread.h" |
| 51 #include "public/platform/WebURLLoaderMockFactory.h" | 52 #include "public/platform/WebURLLoaderMockFactory.h" |
| 52 #include "public/web/WebCache.h" | 53 #include "public/web/WebCache.h" |
| 53 #include "public/web/WebDocument.h" | 54 #include "public/web/WebDocument.h" |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 | 694 |
| 694 void destroy() override { | 695 void destroy() override { |
| 695 container()->setWebLayer(nullptr); | 696 container()->setWebLayer(nullptr); |
| 696 FakeWebPlugin::destroy(); | 697 FakeWebPlugin::destroy(); |
| 697 } | 698 } |
| 698 | 699 |
| 699 private: | 700 private: |
| 700 std::unique_ptr<WebLayer> m_layer; | 701 std::unique_ptr<WebLayer> m_layer; |
| 701 }; | 702 }; |
| 702 | 703 |
| 703 class ScopedSPv2 { | |
| 704 public: | |
| 705 ScopedSPv2() { RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(true); } | |
| 706 ~ScopedSPv2() { m_featuresBackup.restore(); } | |
| 707 | |
| 708 private: | |
| 709 RuntimeEnabledFeatures::Backup m_featuresBackup; | |
| 710 }; | |
| 711 | |
| 712 } // namespace | 704 } // namespace |
| 713 | 705 |
| 714 TEST_F(WebPluginContainerTest, CompositedPluginSPv2) { | 706 TEST_F(WebPluginContainerTest, CompositedPluginSPv2) { |
| 715 ScopedSPv2 enableSPv2; | 707 ScopedSlimmingPaintV2ForTest enableSPv2(true); |
| 716 URLTestHelpers::registerMockedURLFromBaseURL( | 708 URLTestHelpers::registerMockedURLFromBaseURL( |
| 717 WebString::fromUTF8(m_baseURL.c_str()), | 709 WebString::fromUTF8(m_baseURL.c_str()), |
| 718 WebString::fromUTF8("plugin.html")); | 710 WebString::fromUTF8("plugin.html")); |
| 719 CustomPluginWebFrameClient<CompositedPlugin> webFrameClient; | 711 CustomPluginWebFrameClient<CompositedPlugin> webFrameClient; |
| 720 FrameTestHelpers::WebViewHelper webViewHelper; | 712 FrameTestHelpers::WebViewHelper webViewHelper; |
| 721 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin.html", | 713 WebView* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin.html", |
| 722 true, &webFrameClient); | 714 true, &webFrameClient); |
| 723 ASSERT_TRUE(webView); | 715 ASSERT_TRUE(webView); |
| 724 webView->settings()->setPluginsEnabled(true); | 716 webView->settings()->setPluginsEnabled(true); |
| 725 webView->resize(WebSize(800, 600)); | 717 webView->resize(WebSize(800, 600)); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 WebString::fromUTF8("translated-plugin")); | 765 WebString::fromUTF8("translated-plugin")); |
| 774 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true); | 766 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true); |
| 775 | 767 |
| 776 runPendingTasks(); | 768 runPendingTasks(); |
| 777 EXPECT_TRUE( | 769 EXPECT_TRUE( |
| 778 webView->page()->frameHost().eventHandlerRegistry().hasEventHandlers( | 770 webView->page()->frameHost().eventHandlerRegistry().hasEventHandlers( |
| 779 EventHandlerRegistry::WheelEventBlocking)); | 771 EventHandlerRegistry::WheelEventBlocking)); |
| 780 } | 772 } |
| 781 | 773 |
| 782 } // namespace blink | 774 } // namespace blink |
| OLD | NEW |