| 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 "content/renderer/pepper/plugin_instance_throttler_impl.h" | 5 #include "content/renderer/pepper/plugin_instance_throttler_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 protected: | 31 protected: |
| 32 const int kMaximumFramesToExamine = | 32 const int kMaximumFramesToExamine = |
| 33 PluginInstanceThrottlerImpl::kMaximumFramesToExamine; | 33 PluginInstanceThrottlerImpl::kMaximumFramesToExamine; |
| 34 | 34 |
| 35 PluginInstanceThrottlerImplTest() : change_callback_calls_(0) {} | 35 PluginInstanceThrottlerImplTest() : change_callback_calls_(0) {} |
| 36 ~PluginInstanceThrottlerImplTest() override { | 36 ~PluginInstanceThrottlerImplTest() override { |
| 37 throttler_->RemoveObserver(this); | 37 throttler_->RemoveObserver(this); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void SetUp() override { | 40 void SetUp() override { |
| 41 throttler_.reset(new PluginInstanceThrottlerImpl); | 41 throttler_.reset( |
| 42 new PluginInstanceThrottlerImpl(RenderFrame::DONT_RECORD_DECISION)); |
| 42 throttler_->Initialize(nullptr, url::Origin(GURL("http://example.com")), | 43 throttler_->Initialize(nullptr, url::Origin(GURL("http://example.com")), |
| 43 "Shockwave Flash", gfx::Size(100, 100)); | 44 "Shockwave Flash", gfx::Size(100, 100)); |
| 44 throttler_->AddObserver(this); | 45 throttler_->AddObserver(this); |
| 45 } | 46 } |
| 46 | 47 |
| 47 PluginInstanceThrottlerImpl* throttler() { | 48 PluginInstanceThrottlerImpl* throttler() { |
| 48 DCHECK(throttler_.get()); | 49 DCHECK(throttler_.get()); |
| 49 return throttler_.get(); | 50 return throttler_.get(); |
| 50 } | 51 } |
| 51 | 52 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown; | 212 event.modifiers = blink::WebInputEvent::Modifiers::MiddleButtonDown; |
| 212 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); | 213 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); |
| 213 EXPECT_TRUE(throttler()->IsThrottled()); | 214 EXPECT_TRUE(throttler()->IsThrottled()); |
| 214 | 215 |
| 215 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown; | 216 event.modifiers = blink::WebInputEvent::Modifiers::LeftButtonDown; |
| 216 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); | 217 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); |
| 217 EXPECT_FALSE(throttler()->IsThrottled()); | 218 EXPECT_FALSE(throttler()->IsThrottled()); |
| 218 } | 219 } |
| 219 | 220 |
| 220 } // namespace content | 221 } // namespace content |
| OLD | NEW |