| OLD | NEW |
| 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 "chromecast/media/cma/test/mock_frame_consumer.h" | 5 #include "chromecast/media/cma/test/mock_frame_consumer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 MockFrameConsumer::~MockFrameConsumer() { | 28 MockFrameConsumer::~MockFrameConsumer() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 void MockFrameConsumer::Configure( | 31 void MockFrameConsumer::Configure( |
| 32 const std::vector<bool>& delayed_task_pattern, | 32 const std::vector<bool>& delayed_task_pattern, |
| 33 bool last_read_aborted_by_flush, | 33 bool last_read_aborted_by_flush, |
| 34 std::unique_ptr<FrameGeneratorForTest> frame_generator) { | 34 std::unique_ptr<FrameGeneratorForTest> frame_generator) { |
| 35 delayed_task_pattern_ = delayed_task_pattern; | 35 delayed_task_pattern_ = delayed_task_pattern; |
| 36 last_read_aborted_by_flush_ = last_read_aborted_by_flush; | 36 last_read_aborted_by_flush_ = last_read_aborted_by_flush; |
| 37 frame_generator_.reset(frame_generator.release()); | 37 frame_generator_ = std::move(frame_generator); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void MockFrameConsumer::Start(const base::Closure& done_cb) { | 40 void MockFrameConsumer::Start(const base::Closure& done_cb) { |
| 41 done_cb_ = done_cb; | 41 done_cb_ = done_cb; |
| 42 | 42 |
| 43 pattern_idx_ = 0; | 43 pattern_idx_ = 0; |
| 44 | 44 |
| 45 base::ThreadTaskRunnerHandle::Get()->PostTask( | 45 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 46 FROM_HERE, | 46 FROM_HERE, |
| 47 base::Bind(&MockFrameConsumer::ReadFrame, base::Unretained(this))); | 47 base::Bind(&MockFrameConsumer::ReadFrame, base::Unretained(this))); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 void MockFrameConsumer::OnFlushCompleted() { | 109 void MockFrameConsumer::OnFlushCompleted() { |
| 110 EXPECT_EQ(frame_generator_->RemainingFrameCount(), 0u); | 110 EXPECT_EQ(frame_generator_->RemainingFrameCount(), 0u); |
| 111 done_cb_.Run(); | 111 done_cb_.Run(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace media | 114 } // namespace media |
| 115 } // namespace chromecast | 115 } // namespace chromecast |
| OLD | NEW |