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

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

Issue 2758413002: cc/paint: Remove PaintCanvas::peekPixels. (Closed)
Patch Set: update Created 3 years, 9 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" 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 TEST_F(PluginInstanceThrottlerImplTest, ThrottleByKeyframe) { 100 TEST_F(PluginInstanceThrottlerImplTest, ThrottleByKeyframe) {
101 EXPECT_FALSE(throttler()->IsThrottled()); 101 EXPECT_FALSE(throttler()->IsThrottled());
102 EXPECT_EQ(0, change_callback_calls()); 102 EXPECT_EQ(0, change_callback_calls());
103 103
104 SkBitmap boring_bitmap; 104 SkBitmap boring_bitmap;
105 gfx::Canvas canvas(gfx::Size(20, 10), 1.0f, true); 105 gfx::Canvas canvas(gfx::Size(20, 10), 1.0f, true);
106 canvas.FillRect(gfx::Rect(20, 10), SK_ColorBLACK); 106 canvas.FillRect(gfx::Rect(20, 10), SK_ColorBLACK);
107 canvas.FillRect(gfx::Rect(10, 10), SK_ColorWHITE); 107 canvas.FillRect(gfx::Rect(10, 10), SK_ColorWHITE);
108 SkBitmap interesting_bitmap = canvas.ToBitmap(); 108 SkBitmap interesting_bitmap = canvas.GetBitmap();
109 109
110 // Don't throttle for a boring frame. 110 // Don't throttle for a boring frame.
111 throttler()->OnImageFlush(boring_bitmap); 111 throttler()->OnImageFlush(boring_bitmap);
112 EXPECT_FALSE(throttler()->IsThrottled()); 112 EXPECT_FALSE(throttler()->IsThrottled());
113 EXPECT_EQ(0, change_callback_calls()); 113 EXPECT_EQ(0, change_callback_calls());
114 114
115 // Throttle after an interesting frame. 115 // Throttle after an interesting frame.
116 throttler()->OnImageFlush(interesting_bitmap); 116 throttler()->OnImageFlush(interesting_bitmap);
117 EXPECT_TRUE(throttler()->IsThrottled()); 117 EXPECT_TRUE(throttler()->IsThrottled());
118 EXPECT_EQ(1, change_callback_calls()); 118 EXPECT_EQ(1, change_callback_calls());
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 event.setModifiers(blink::WebInputEvent::Modifiers::MiddleButtonDown); 215 event.setModifiers(blink::WebInputEvent::Modifiers::MiddleButtonDown);
216 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); 216 EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
217 EXPECT_TRUE(throttler()->IsThrottled()); 217 EXPECT_TRUE(throttler()->IsThrottled());
218 218
219 event.setModifiers(blink::WebInputEvent::Modifiers::LeftButtonDown); 219 event.setModifiers(blink::WebInputEvent::Modifiers::LeftButtonDown);
220 EXPECT_TRUE(throttler()->ConsumeInputEvent(event)); 220 EXPECT_TRUE(throttler()->ConsumeInputEvent(event));
221 EXPECT_FALSE(throttler()->IsThrottled()); 221 EXPECT_FALSE(throttler()->IsThrottled());
222 } 222 }
223 223
224 } // namespace content 224 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698