| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |