| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback_helpers.h" | 6 #include "base/callback_helpers.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/child/child_process.h" | 10 #include "content/child/child_process.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 source_->SetDeviceInfo(device_info); | 148 source_->SetDeviceInfo(device_info); |
| 149 webkit_source_.initialize(base::UTF8ToUTF16("dummy_source_id"), | 149 webkit_source_.initialize(base::UTF8ToUTF16("dummy_source_id"), |
| 150 blink::WebMediaStreamSource::TypeVideo, | 150 blink::WebMediaStreamSource::TypeVideo, |
| 151 base::UTF8ToUTF16("dummy_source_name"), | 151 base::UTF8ToUTF16("dummy_source_name"), |
| 152 false /* remote */ , true /* readonly */); | 152 false /* remote */ , true /* readonly */); |
| 153 webkit_source_.setExtraData(source_); | 153 webkit_source_.setExtraData(source_); |
| 154 webkit_source_id_ = webkit_source_.id(); | 154 webkit_source_id_ = webkit_source_.id(); |
| 155 blink::WebMediaStreamTrack track = StartSource(); | 155 blink::WebMediaStreamTrack track = StartSource(); |
| 156 message_loop_.RunUntilIdle(); | 156 message_loop_.RunUntilIdle(); |
| 157 | 157 |
| 158 delegate_ptr->OnStateUpdateOnRenderThread(VIDEO_CAPTURE_STATE_STARTED); | 158 delegate_ptr->OnStateUpdate(VIDEO_CAPTURE_STATE_STARTED); |
| 159 message_loop_.RunUntilIdle(); | 159 message_loop_.RunUntilIdle(); |
| 160 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive, | 160 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateLive, |
| 161 webkit_source_.readyState()); | 161 webkit_source_.readyState()); |
| 162 | 162 |
| 163 EXPECT_FALSE(source_stopped_); | 163 EXPECT_FALSE(source_stopped_); |
| 164 delegate_ptr->OnStateUpdateOnRenderThread(VIDEO_CAPTURE_STATE_ERROR); | 164 delegate_ptr->OnStateUpdate(VIDEO_CAPTURE_STATE_ERROR); |
| 165 message_loop_.RunUntilIdle(); | 165 message_loop_.RunUntilIdle(); |
| 166 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, | 166 EXPECT_EQ(blink::WebMediaStreamSource::ReadyStateEnded, |
| 167 webkit_source_.readyState()); | 167 webkit_source_.readyState()); |
| 168 // Verify that MediaStreamSource::SourceStoppedCallback has been triggered. | 168 // Verify that MediaStreamSource::SourceStoppedCallback has been triggered. |
| 169 EXPECT_TRUE(source_stopped_); | 169 EXPECT_TRUE(source_stopped_); |
| 170 } | 170 } |
| 171 | 171 |
| 172 class FakeMediaStreamVideoSink : public MediaStreamVideoSink { | 172 class FakeMediaStreamVideoSink : public MediaStreamVideoSink { |
| 173 public: | 173 public: |
| 174 FakeMediaStreamVideoSink(base::TimeTicks* capture_time, | 174 FakeMediaStreamVideoSink(base::TimeTicks* capture_time, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 run_loop.Run(); | 237 run_loop.Run(); |
| 238 FakeMediaStreamVideoSink::RemoveFromVideoTrack(&fake_sink, track); | 238 FakeMediaStreamVideoSink::RemoveFromVideoTrack(&fake_sink, track); |
| 239 EXPECT_EQ(reference_capture_time, capture_time); | 239 EXPECT_EQ(reference_capture_time, capture_time); |
| 240 double metadata_value; | 240 double metadata_value; |
| 241 EXPECT_TRUE(metadata.GetDouble(media::VideoFrameMetadata::FRAME_RATE, | 241 EXPECT_TRUE(metadata.GetDouble(media::VideoFrameMetadata::FRAME_RATE, |
| 242 &metadata_value)); | 242 &metadata_value)); |
| 243 EXPECT_EQ(30.0, metadata_value); | 243 EXPECT_EQ(30.0, metadata_value); |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // namespace content | 246 } // namespace content |
| OLD | NEW |