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

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

Issue 2389973002: Use std::unique_ptr to signal ownership transfer in WebCompositorSupport (Closed)
Patch Set: rebase Created 4 years, 2 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "public/web/WebPrintParams.h" 58 #include "public/web/WebPrintParams.h"
59 #include "public/web/WebSettings.h" 59 #include "public/web/WebSettings.h"
60 #include "public/web/WebView.h" 60 #include "public/web/WebView.h"
61 #include "testing/gtest/include/gtest/gtest.h" 61 #include "testing/gtest/include/gtest/gtest.h"
62 #include "third_party/skia/include/core/SkPictureRecorder.h" 62 #include "third_party/skia/include/core/SkPictureRecorder.h"
63 #include "web/WebLocalFrameImpl.h" 63 #include "web/WebLocalFrameImpl.h"
64 #include "web/WebPluginContainerImpl.h" 64 #include "web/WebPluginContainerImpl.h"
65 #include "web/WebViewImpl.h" 65 #include "web/WebViewImpl.h"
66 #include "web/tests/FakeWebPlugin.h" 66 #include "web/tests/FakeWebPlugin.h"
67 #include "web/tests/FrameTestHelpers.h" 67 #include "web/tests/FrameTestHelpers.h"
68 #include "wtf/PtrUtil.h"
69 #include <memory> 68 #include <memory>
70 69
71 using blink::testing::runPendingTasks; 70 using blink::testing::runPendingTasks;
72 71
73 namespace blink { 72 namespace blink {
74 73
75 class WebPluginContainerTest : public ::testing::Test { 74 class WebPluginContainerTest : public ::testing::Test {
76 public: 75 public:
77 WebPluginContainerTest() : m_baseURL("http://www.test.com/") {} 76 WebPluginContainerTest() : m_baseURL("http://www.test.com/") {}
78 77
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 671
673 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(topmostRect)); 672 EXPECT_FALSE(pluginContainerImpl->isRectTopmost(topmostRect));
674 } 673 }
675 674
676 namespace { 675 namespace {
677 676
678 class CompositedPlugin : public FakeWebPlugin { 677 class CompositedPlugin : public FakeWebPlugin {
679 public: 678 public:
680 CompositedPlugin(WebLocalFrame* frame, const WebPluginParams& params) 679 CompositedPlugin(WebLocalFrame* frame, const WebPluginParams& params)
681 : FakeWebPlugin(frame, params), 680 : FakeWebPlugin(frame, params),
682 m_layer(wrapUnique( 681 m_layer(Platform::current()->compositorSupport()->createLayer()) {}
683 Platform::current()->compositorSupport()->createLayer())) {}
684 682
685 WebLayer* getWebLayer() const { return m_layer.get(); } 683 WebLayer* getWebLayer() const { return m_layer.get(); }
686 684
687 // WebPlugin 685 // WebPlugin
688 686
689 bool initialize(WebPluginContainer* container) override { 687 bool initialize(WebPluginContainer* container) override {
690 if (!FakeWebPlugin::initialize(container)) 688 if (!FakeWebPlugin::initialize(container))
691 return false; 689 return false;
692 container->setWebLayer(m_layer.get()); 690 container->setWebLayer(m_layer.get());
693 return true; 691 return true;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 WebString::fromUTF8("translated-plugin")); 767 WebString::fromUTF8("translated-plugin"));
770 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true); 768 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true);
771 769
772 runPendingTasks(); 770 runPendingTasks();
773 EXPECT_TRUE( 771 EXPECT_TRUE(
774 webView->page()->frameHost().eventHandlerRegistry().hasEventHandlers( 772 webView->page()->frameHost().eventHandlerRegistry().hasEventHandlers(
775 EventHandlerRegistry::WheelEventBlocking)); 773 EventHandlerRegistry::WheelEventBlocking));
776 } 774 }
777 775
778 } // namespace blink 776 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698