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

Side by Side Diff: content/renderer/pepper/plugin_instance_throttler_impl_unittest.cc

Issue 1873783003: Convert //content/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 "content/renderer/pepper/plugin_instance_throttler_impl.h"
6
7 #include <memory>
8
5 #include "base/bind.h" 9 #include "base/bind.h"
6 #include "base/command_line.h" 10 #include "base/command_line.h"
7 #include "base/logging.h" 11 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
10 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
11 #include "content/public/renderer/render_frame.h" 14 #include "content/public/renderer/render_frame.h"
12 #include "content/renderer/pepper/plugin_instance_throttler_impl.h"
13 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/WebKit/public/web/WebInputEvent.h" 17 #include "third_party/WebKit/public/web/WebInputEvent.h"
16 #include "third_party/WebKit/public/web/WebPluginParams.h" 18 #include "third_party/WebKit/public/web/WebPluginParams.h"
17 #include "ui/gfx/canvas.h" 19 #include "ui/gfx/canvas.h"
18 #include "url/gurl.h" 20 #include "url/gurl.h"
19 #include "url/origin.h" 21 #include "url/origin.h"
20 22
21 using testing::_; 23 using testing::_;
22 using testing::Return; 24 using testing::Return;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown; 67 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown;
66 EXPECT_EQ(expect_consumed, throttler()->ConsumeInputEvent(event)); 68 EXPECT_EQ(expect_consumed, throttler()->ConsumeInputEvent(event));
67 EXPECT_EQ(expect_throttled, throttler()->IsThrottled()); 69 EXPECT_EQ(expect_throttled, throttler()->IsThrottled());
68 EXPECT_EQ(expect_change_callback_count, change_callback_calls()); 70 EXPECT_EQ(expect_change_callback_count, change_callback_calls());
69 } 71 }
70 72
71 private: 73 private:
72 // PluginInstanceThrottlerImpl::Observer 74 // PluginInstanceThrottlerImpl::Observer
73 void OnThrottleStateChange() override { ++change_callback_calls_; } 75 void OnThrottleStateChange() override { ++change_callback_calls_; }
74 76
75 scoped_ptr<PluginInstanceThrottlerImpl> throttler_; 77 std::unique_ptr<PluginInstanceThrottlerImpl> throttler_;
76 78
77 int change_callback_calls_; 79 int change_callback_calls_;
78 80
79 base::MessageLoop loop_; 81 base::MessageLoop loop_;
80 }; 82 };
81 83
82 TEST_F(PluginInstanceThrottlerImplTest, ThrottleAndUnthrottleByClick) { 84 TEST_F(PluginInstanceThrottlerImplTest, ThrottleAndUnthrottleByClick) {
83 EXPECT_FALSE(throttler()->IsThrottled()); 85 EXPECT_FALSE(throttler()->IsThrottled());
84 EXPECT_EQ(0, change_callback_calls()); 86 EXPECT_EQ(0, change_callback_calls());
85 87
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown; 211 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown;
210 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); 212 EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
211 EXPECT_TRUE(throttler()->IsThrottled()); 213 EXPECT_TRUE(throttler()->IsThrottled());
212 214
213 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown; 215 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown;
214 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); 216 EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
215 EXPECT_FALSE(throttler()->IsThrottled()); 217 EXPECT_FALSE(throttler()->IsThrottled());
216 } 218 }
217 219
218 } // namespace content 220 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/plugin_instance_throttler_impl.cc ('k') | content/renderer/pepper/plugin_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698