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

Side by Side Diff: media/blink/video_frame_compositor_unittest.cc

Issue 1339373003: Fix media media_blink_unittest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/test/simple_test_tick_clock.h" 8 #include "base/test/simple_test_tick_clock.h"
9 #include "cc/layers/video_frame_provider.h" 9 #include "cc/layers/video_frame_provider.h"
10 #include "media/base/video_frame.h" 10 #include "media/base/video_frame.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 EXPECT_CALL(*this, Render(_, _, _)) 252 EXPECT_CALL(*this, Render(_, _, _))
253 .WillOnce(Return(not_opaque_frame)) 253 .WillOnce(Return(not_opaque_frame))
254 .WillOnce(Return(not_opaque_frame)) 254 .WillOnce(Return(not_opaque_frame))
255 .WillOnce(Return(opaque_frame)) 255 .WillOnce(Return(opaque_frame))
256 .WillOnce(Return(opaque_frame)); 256 .WillOnce(Return(opaque_frame));
257 StartVideoRendererSink(); 257 StartVideoRendererSink();
258 EXPECT_FALSE(opaque()); 258 EXPECT_FALSE(opaque());
259 EXPECT_EQ(1, opacity_changed_count()); 259 EXPECT_EQ(1, opacity_changed_count());
260 260
261 EXPECT_FALSE( 261 EXPECT_TRUE(
262 compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks())); 262 compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
263 RenderFrame(); 263 RenderFrame();
264 EXPECT_FALSE(opaque()); 264 EXPECT_FALSE(opaque());
265 EXPECT_EQ(1, opacity_changed_count()); 265 EXPECT_EQ(1, opacity_changed_count());
266 266
267 EXPECT_TRUE( 267 EXPECT_TRUE(
268 compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks())); 268 compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
269 RenderFrame(); 269 RenderFrame();
270 EXPECT_TRUE(opaque()); 270 EXPECT_TRUE(opaque());
271 EXPECT_EQ(2, opacity_changed_count()); 271 EXPECT_EQ(2, opacity_changed_count());
272 272
273 EXPECT_FALSE( 273 EXPECT_FALSE(
274 compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks())); 274 compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
275 EXPECT_TRUE(opaque()); 275 EXPECT_TRUE(opaque());
276 EXPECT_EQ(2, opacity_changed_count()); 276 EXPECT_EQ(2, opacity_changed_count());
277 RenderFrame(); 277 RenderFrame();
278 278
279 StopVideoRendererSink(true); 279 StopVideoRendererSink(true);
280 } 280 }
281 281
282 TEST_F(VideoFrameCompositorTest, VideoRendererSinkFrameDropped) { 282 TEST_F(VideoFrameCompositorTest, VideoRendererSinkFrameDropped) {
283 scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame(); 283 scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame();
284 284
285 EXPECT_CALL(*this, Render(_, _, _)).WillRepeatedly(Return(opaque_frame)); 285 EXPECT_CALL(*this, Render(_, _, _)).WillRepeatedly(Return(opaque_frame));
286 StartVideoRendererSink(); 286 StartVideoRendererSink();
287 287
288 // The first UpdateCurrentFrame() after a background render, which starting 288 EXPECT_TRUE(
289 // the sink does automatically, won't report a dropped frame.
290 EXPECT_FALSE(
291 compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks())); 289 compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
292 290
293 // Another call should trigger a dropped frame callback. 291 // Another call should trigger a dropped frame callback.
294 EXPECT_CALL(*this, OnFrameDropped()); 292 EXPECT_CALL(*this, OnFrameDropped());
295 EXPECT_FALSE( 293 EXPECT_FALSE(
296 compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks())); 294 compositor()->UpdateCurrentFrame(base::TimeTicks(), base::TimeTicks()));
297 295
298 // Ensure it always happens until the frame is rendered. 296 // Ensure it always happens until the frame is rendered.
299 EXPECT_CALL(*this, OnFrameDropped()); 297 EXPECT_CALL(*this, OnFrameDropped());
300 EXPECT_FALSE( 298 EXPECT_FALSE(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 425
428 // Advancing the tick clock should allow a new frame to be requested. 426 // Advancing the tick clock should allow a new frame to be requested.
429 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(10)); 427 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(10));
430 ASSERT_EQ(opaque_frame_2, compositor()->GetCurrentFrameAndUpdateIfStale()); 428 ASSERT_EQ(opaque_frame_2, compositor()->GetCurrentFrameAndUpdateIfStale());
431 429
432 // Background rendering should tick another render callback. 430 // Background rendering should tick another render callback.
433 StopVideoRendererSink(false); 431 StopVideoRendererSink(false);
434 } 432 }
435 433
436 } // namespace media 434 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698