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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/child/child_process.h" | 9 #include "content/child/child_process.h" |
10 #include "content/renderer/media/media_stream_video_renderer_sink.h" | 10 #include "content/renderer/media/media_stream_video_renderer_sink.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 message_loop_.task_runner(), message_loop_.task_runner().get(), | 52 message_loop_.task_runner(), message_loop_.task_runner().get(), |
53 nullptr /* gpu_factories */); | 53 nullptr /* gpu_factories */); |
54 | 54 |
55 EXPECT_TRUE(IsInStoppedState()); | 55 EXPECT_TRUE(IsInStoppedState()); |
56 } | 56 } |
57 | 57 |
58 ~MediaStreamVideoRendererSinkTest() { | 58 ~MediaStreamVideoRendererSinkTest() { |
59 media_stream_video_renderer_sink_ = nullptr; | 59 media_stream_video_renderer_sink_ = nullptr; |
60 registry_.reset(); | 60 registry_.reset(); |
61 blink::WebHeap::collectAllGarbageForTesting(); | 61 blink::WebHeap::collectAllGarbageForTesting(); |
| 62 |
| 63 // Let the message loop run to finish destroying the pool. |
| 64 base::RunLoop().RunUntilIdle(); |
62 } | 65 } |
63 | 66 |
64 MOCK_METHOD1(RepaintCallback, void(const scoped_refptr<media::VideoFrame>&)); | 67 MOCK_METHOD1(RepaintCallback, void(const scoped_refptr<media::VideoFrame>&)); |
65 MOCK_METHOD0(ErrorCallback, void(void)); | 68 MOCK_METHOD0(ErrorCallback, void(void)); |
66 | 69 |
67 bool IsInStartedState() const { | 70 bool IsInStartedState() const { |
68 return media_stream_video_renderer_sink_->state_ == | 71 return media_stream_video_renderer_sink_->state_ == |
69 MediaStreamVideoRendererSink::STARTED; | 72 MediaStreamVideoRendererSink::STARTED; |
70 } | 73 } |
71 bool IsInStoppedState() const { | 74 bool IsInStoppedState() const { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 ASSERT_EQ(1u, frame_ready_cbs_.size()); | 152 ASSERT_EQ(1u, frame_ready_cbs_.size()); |
150 | 153 |
151 EXPECT_CALL(*this, RepaintCallback(video_frame)).Times(1); | 154 EXPECT_CALL(*this, RepaintCallback(video_frame)).Times(1); |
152 frame_ready_cbs_[0].Run(); | 155 frame_ready_cbs_[0].Run(); |
153 message_loop_.RunUntilIdle(); | 156 message_loop_.RunUntilIdle(); |
154 | 157 |
155 media_stream_video_renderer_sink_->Stop(); | 158 media_stream_video_renderer_sink_->Stop(); |
156 } | 159 } |
157 | 160 |
158 } // namespace content | 161 } // namespace content |
OLD | NEW |