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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 class MediaStreamVideoTrackTest : public ::testing::Test { | 31 class MediaStreamVideoTrackTest : public ::testing::Test { |
32 public: | 32 public: |
33 MediaStreamVideoTrackTest() | 33 MediaStreamVideoTrackTest() |
34 : child_process_(new ChildProcess()), | 34 : child_process_(new ChildProcess()), |
35 mock_source_(new MockMediaStreamVideoSource(false)), | 35 mock_source_(new MockMediaStreamVideoSource(false)), |
36 source_started_(false) { | 36 source_started_(false) { |
37 blink_source_.initialize(base::UTF8ToUTF16("dummy_source_id"), | 37 blink_source_.initialize(base::UTF8ToUTF16("dummy_source_id"), |
38 blink::WebMediaStreamSource::TypeVideo, | 38 blink::WebMediaStreamSource::TypeVideo, |
39 base::UTF8ToUTF16("dummy_source_name"), | 39 base::UTF8ToUTF16("dummy_source_name")); |
40 false /* remote */); | |
41 blink_source_.setExtraData(mock_source_); | 40 blink_source_.setExtraData(mock_source_); |
42 } | 41 } |
43 | 42 |
44 ~MediaStreamVideoTrackTest() override {} | 43 ~MediaStreamVideoTrackTest() override {} |
45 | 44 |
46 void TearDown() override { | 45 void TearDown() override { |
47 blink_source_.reset(); | 46 blink_source_.reset(); |
48 blink::WebHeap::collectAllGarbageForTesting(); | 47 blink::WebHeap::collectAllGarbageForTesting(); |
49 } | 48 } |
50 | 49 |
(...skipping 29 matching lines...) Expand all Loading... |
80 source_started_ = true; | 79 source_started_ = true; |
81 } | 80 } |
82 return track; | 81 return track; |
83 } | 82 } |
84 | 83 |
85 void UpdateVideoSourceToRespondToRequestRefreshFrame() { | 84 void UpdateVideoSourceToRespondToRequestRefreshFrame() { |
86 blink_source_.reset(); | 85 blink_source_.reset(); |
87 mock_source_ = new MockMediaStreamVideoSource(false, true); | 86 mock_source_ = new MockMediaStreamVideoSource(false, true); |
88 blink_source_.initialize(base::UTF8ToUTF16("dummy_source_id"), | 87 blink_source_.initialize(base::UTF8ToUTF16("dummy_source_id"), |
89 blink::WebMediaStreamSource::TypeVideo, | 88 blink::WebMediaStreamSource::TypeVideo, |
90 base::UTF8ToUTF16("dummy_source_name"), | 89 base::UTF8ToUTF16("dummy_source_name")); |
91 false /* remote */); | |
92 blink_source_.setExtraData(mock_source_); | 90 blink_source_.setExtraData(mock_source_); |
93 } | 91 } |
94 | 92 |
95 MockMediaStreamVideoSource* mock_source() { return mock_source_; } | 93 MockMediaStreamVideoSource* mock_source() { return mock_source_; } |
96 const blink::WebMediaStreamSource& blink_source() const { | 94 const blink::WebMediaStreamSource& blink_source() const { |
97 return blink_source_; | 95 return blink_source_; |
98 } | 96 } |
99 | 97 |
100 private: | 98 private: |
101 const base::MessageLoopForUI message_loop_; | 99 const base::MessageLoopForUI message_loop_; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 base::Closure quit_closure = run_loop.QuitClosure(); | 247 base::Closure quit_closure = run_loop.QuitClosure(); |
250 EXPECT_CALL(sink, OnVideoFrame()).WillOnce(RunClosure(quit_closure)); | 248 EXPECT_CALL(sink, OnVideoFrame()).WillOnce(RunClosure(quit_closure)); |
251 sink.ConnectToTrack(track); | 249 sink.ConnectToTrack(track); |
252 run_loop.Run(); | 250 run_loop.Run(); |
253 EXPECT_EQ(1, sink.number_of_frames()); | 251 EXPECT_EQ(1, sink.number_of_frames()); |
254 | 252 |
255 sink.DisconnectFromTrack(); | 253 sink.DisconnectFromTrack(); |
256 } | 254 } |
257 | 255 |
258 } // namespace content | 256 } // namespace content |
OLD | NEW |