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

Side by Side Diff: media/base/null_video_sink_unittest.cc

Issue 2239163002: Add "repaint" option to PaintSingleFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_player_simplified
Patch Set: Created 4 years, 4 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/base/null_video_sink.cc ('k') | media/base/video_renderer_sink.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <memory> 5 #include <memory>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 { 107 {
108 SCOPED_TRACE("Waiting for stop event."); 108 SCOPED_TRACE("Waiting for stop event.");
109 WaitableMessageLoopEvent event; 109 WaitableMessageLoopEvent event;
110 sink->set_stop_cb(event.GetClosure()); 110 sink->set_stop_cb(event.GetClosure());
111 sink->Stop(); 111 sink->Stop();
112 event.RunAndWait(); 112 event.RunAndWait();
113 } 113 }
114 114
115 // The sink shouldn't have to be started to use the paint method. 115 // The sink shouldn't have to be started to use the paint method.
116 EXPECT_CALL(*this, FrameReceived(test_frame)); 116 EXPECT_CALL(*this, FrameReceived(test_frame));
117 sink->PaintSingleFrame(test_frame); 117 sink->PaintSingleFrame(test_frame, false);
118 } 118 }
119 119
120 TEST_F(NullVideoSinkTest, ClocklessFunctionality) { 120 TEST_F(NullVideoSinkTest, ClocklessFunctionality) {
121 // Construct the sink with a huge interval, it should still complete quickly. 121 // Construct the sink with a huge interval, it should still complete quickly.
122 const base::TimeDelta interval = base::TimeDelta::FromSeconds(10); 122 const base::TimeDelta interval = base::TimeDelta::FromSeconds(10);
123 std::unique_ptr<NullVideoSink> sink = ConstructSink(true, interval); 123 std::unique_ptr<NullVideoSink> sink = ConstructSink(true, interval);
124 124
125 scoped_refptr<VideoFrame> test_frame = CreateFrame(base::TimeDelta()); 125 scoped_refptr<VideoFrame> test_frame = CreateFrame(base::TimeDelta());
126 scoped_refptr<VideoFrame> test_frame_2 = CreateFrame(interval); 126 scoped_refptr<VideoFrame> test_frame_2 = CreateFrame(interval);
127 sink->Start(this); 127 sink->Start(this);
(...skipping 18 matching lines...) Expand all
146 .WillOnce( 146 .WillOnce(
147 DoAll(RunClosure(event.GetClosure()), Return(test_frame_2))); 147 DoAll(RunClosure(event.GetClosure()), Return(test_frame_2)));
148 } 148 }
149 } 149 }
150 event.RunAndWait(); 150 event.RunAndWait();
151 ASSERT_LT(base::TimeTicks::Now() - now, kTestRuns * interval); 151 ASSERT_LT(base::TimeTicks::Now() - now, kTestRuns * interval);
152 sink->Stop(); 152 sink->Stop();
153 } 153 }
154 154
155 } // namespace media 155 } // namespace media
OLDNEW
« no previous file with comments | « media/base/null_video_sink.cc ('k') | media/base/video_renderer_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698