OLD | NEW |
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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 PluginInstanceThrottlerImplTest() : change_callback_calls_(0) {} | 33 PluginInstanceThrottlerImplTest() : change_callback_calls_(0) {} |
34 ~PluginInstanceThrottlerImplTest() override { | 34 ~PluginInstanceThrottlerImplTest() override { |
35 throttler_->RemoveObserver(this); | 35 throttler_->RemoveObserver(this); |
36 } | 36 } |
37 | 37 |
38 void SetUp() override { | 38 void SetUp() override { |
39 blink::WebRect rect; | 39 blink::WebRect rect; |
40 rect.width = 100; | 40 rect.width = 100; |
41 rect.height = 100; | 41 rect.height = 100; |
42 throttler_.reset( | 42 throttler_.reset(new PluginInstanceThrottlerImpl); |
43 new PluginInstanceThrottlerImpl(true /* power_saver_enabled */)); | |
44 throttler_->Initialize(nullptr, GURL("http://example.com"), | 43 throttler_->Initialize(nullptr, GURL("http://example.com"), |
45 "Shockwave Flash", rect); | 44 "Shockwave Flash", rect); |
46 throttler_->AddObserver(this); | 45 throttler_->AddObserver(this); |
47 } | 46 } |
48 | 47 |
49 PluginInstanceThrottlerImpl* throttler() { | 48 PluginInstanceThrottlerImpl* throttler() { |
50 DCHECK(throttler_.get()); | 49 DCHECK(throttler_.get()); |
51 return throttler_.get(); | 50 return throttler_.get(); |
52 } | 51 } |
53 | 52 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown; | 226 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown; |
228 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); | 227 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); |
229 EXPECT_TRUE(throttler()->IsThrottled()); | 228 EXPECT_TRUE(throttler()->IsThrottled()); |
230 | 229 |
231 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown; | 230 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown; |
232 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); | 231 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); |
233 EXPECT_FALSE(throttler()->IsThrottled()); | 232 EXPECT_FALSE(throttler()->IsThrottled()); |
234 } | 233 } |
235 | 234 |
236 } // namespace content | 235 } // namespace content |
OLD | NEW |