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

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

Issue 2855123003: Remove rendundant WebLocalFrame parameter in various plugin code. (Closed)
Patch Set: Fix Android Created 3 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "public/web/WebHelperPlugin.h" 5 #include "public/web/WebHelperPlugin.h"
6 6
7 #include "platform/testing/UnitTestHelpers.h" 7 #include "platform/testing/UnitTestHelpers.h"
8 #include "public/web/WebFrameClient.h" 8 #include "public/web/WebFrameClient.h"
9 #include "public/web/WebLocalFrame.h" 9 #include "public/web/WebLocalFrame.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "web/tests/FakeWebPlugin.h" 11 #include "web/tests/FakeWebPlugin.h"
12 #include "web/tests/FrameTestHelpers.h" 12 #include "web/tests/FrameTestHelpers.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 namespace { 16 namespace {
17 17
18 class FakePlaceholderWebPlugin : public FakeWebPlugin { 18 class FakePlaceholderWebPlugin : public FakeWebPlugin {
19 public: 19 public:
20 FakePlaceholderWebPlugin(WebFrame* frame, const WebPluginParams& params) 20 explicit FakePlaceholderWebPlugin(const WebPluginParams& params)
21 : FakeWebPlugin(frame, params) {} 21 : FakeWebPlugin(params) {}
22 ~FakePlaceholderWebPlugin() override {} 22 ~FakePlaceholderWebPlugin() override {}
23 23
24 bool IsPlaceholder() override { return true; } 24 bool IsPlaceholder() override { return true; }
25 }; 25 };
26 26
27 class WebHelperPluginFrameClient : public FrameTestHelpers::TestWebFrameClient { 27 class WebHelperPluginFrameClient : public FrameTestHelpers::TestWebFrameClient {
28 public: 28 public:
29 WebHelperPluginFrameClient() : create_placeholder_(false) {} 29 WebHelperPluginFrameClient() : create_placeholder_(false) {}
30 ~WebHelperPluginFrameClient() override {} 30 ~WebHelperPluginFrameClient() override {}
31 31
32 WebPlugin* CreatePlugin(WebLocalFrame* frame, 32 WebPlugin* CreatePlugin(const WebPluginParams& params) override {
33 const WebPluginParams& params) override { 33 return create_placeholder_ ? new FakePlaceholderWebPlugin(params)
34 return create_placeholder_ ? new FakePlaceholderWebPlugin(frame, params) 34 : new FakeWebPlugin(params);
35 : new FakeWebPlugin(frame, params);
36 } 35 }
37 36
38 void SetCreatePlaceholder(bool create_placeholder) { 37 void SetCreatePlaceholder(bool create_placeholder) {
39 create_placeholder_ = create_placeholder; 38 create_placeholder_ = create_placeholder;
40 } 39 }
41 40
42 private: 41 private:
43 bool create_placeholder_; 42 bool create_placeholder_;
44 }; 43 };
45 44
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 frame_client_.SetCreatePlaceholder(true); 83 frame_client_.SetCreatePlaceholder(true);
85 84
86 plugin_.reset(WebHelperPlugin::Create( 85 plugin_.reset(WebHelperPlugin::Create(
87 "hello", helper_.WebView()->MainFrame()->ToWebLocalFrame())); 86 "hello", helper_.WebView()->MainFrame()->ToWebLocalFrame()));
88 EXPECT_EQ(0, plugin_.get()); 87 EXPECT_EQ(0, plugin_.get());
89 } 88 }
90 89
91 } // namespace 90 } // namespace
92 91
93 } // namespace blink 92 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698