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

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

Issue 1996763002: Make painting a single frame a permanent API on VideoRendererSink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 4 years, 7 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 | « media/blink/video_frame_compositor.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | 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/macros.h" 6 #include "base/macros.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/simple_test_tick_clock.h" 9 #include "base/test/simple_test_tick_clock.h"
10 #include "cc/layers/video_frame_provider.h" 10 #include "cc/layers/video_frame_provider.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 int did_receive_frame_count_; 96 int did_receive_frame_count_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositorTest); 98 DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositorTest);
99 }; 99 };
100 100
101 TEST_F(VideoFrameCompositorTest, InitialValues) { 101 TEST_F(VideoFrameCompositorTest, InitialValues) {
102 EXPECT_FALSE(compositor()->GetCurrentFrame().get()); 102 EXPECT_FALSE(compositor()->GetCurrentFrame().get());
103 } 103 }
104 104
105 TEST_F(VideoFrameCompositorTest, PaintFrameUsingOldRenderingPath) { 105 TEST_F(VideoFrameCompositorTest, PaintSingleFrame) {
106 scoped_refptr<VideoFrame> expected = VideoFrame::CreateEOSFrame(); 106 scoped_refptr<VideoFrame> expected = VideoFrame::CreateEOSFrame();
107 107
108 // Should notify compositor synchronously. 108 // Should notify compositor synchronously.
109 EXPECT_EQ(0, did_receive_frame_count()); 109 EXPECT_EQ(0, did_receive_frame_count());
110 compositor()->PaintFrameUsingOldRenderingPath(expected); 110 compositor()->PaintSingleFrame(expected);
111 scoped_refptr<VideoFrame> actual = compositor()->GetCurrentFrame(); 111 scoped_refptr<VideoFrame> actual = compositor()->GetCurrentFrame();
112 EXPECT_EQ(expected, actual); 112 EXPECT_EQ(expected, actual);
113 EXPECT_EQ(1, did_receive_frame_count()); 113 EXPECT_EQ(1, did_receive_frame_count());
114 } 114 }
115 115
116 TEST_F(VideoFrameCompositorTest, VideoRendererSinkFrameDropped) { 116 TEST_F(VideoFrameCompositorTest, VideoRendererSinkFrameDropped) {
117 scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame(); 117 scoped_refptr<VideoFrame> opaque_frame = CreateOpaqueFrame();
118 118
119 EXPECT_CALL(*this, Render(_, _, _)).WillRepeatedly(Return(opaque_frame)); 119 EXPECT_CALL(*this, Render(_, _, _)).WillRepeatedly(Return(opaque_frame));
120 StartVideoRendererSink(); 120 StartVideoRendererSink();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 // Advancing the tick clock should allow a new frame to be requested. 260 // Advancing the tick clock should allow a new frame to be requested.
261 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(10)); 261 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(10));
262 ASSERT_EQ(opaque_frame_2, compositor()->GetCurrentFrameAndUpdateIfStale()); 262 ASSERT_EQ(opaque_frame_2, compositor()->GetCurrentFrameAndUpdateIfStale());
263 263
264 // Background rendering should tick another render callback. 264 // Background rendering should tick another render callback.
265 StopVideoRendererSink(false); 265 StopVideoRendererSink(false);
266 } 266 }
267 267
268 } // namespace media 268 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/video_frame_compositor.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698