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/message_loop/message_loop.h" |
6 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
7 #include "content/child/child_process.h" | 8 #include "content/child/child_process.h" |
8 #include "content/renderer/media/media_stream_video_capturer_source.h" | 9 #include "content/renderer/media/media_stream_video_capturer_source.h" |
9 #include "content/renderer/media/media_stream_video_track.h" | 10 #include "content/renderer/media/media_stream_video_track.h" |
10 #include "content/renderer/media/mock_media_constraint_factory.h" | 11 #include "content/renderer/media/mock_media_constraint_factory.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 base::Bind( | 58 base::Bind( |
58 &MediaStreamVideoCapturerSourceTest::OnConstraintsApplied, | 59 &MediaStreamVideoCapturerSourceTest::OnConstraintsApplied, |
59 base::Unretained(this)), | 60 base::Unretained(this)), |
60 enabled); | 61 enabled); |
61 } | 62 } |
62 | 63 |
63 protected: | 64 protected: |
64 void OnConstraintsApplied(MediaStreamSource* source, bool success) { | 65 void OnConstraintsApplied(MediaStreamSource* source, bool success) { |
65 } | 66 } |
66 | 67 |
| 68 base::MessageLoopForUI message_loop_; |
67 scoped_ptr<ChildProcess> child_process_; | 69 scoped_ptr<ChildProcess> child_process_; |
68 blink::WebMediaStreamSource webkit_source_; | 70 blink::WebMediaStreamSource webkit_source_; |
69 MediaStreamVideoCapturerSource* source_; // owned by webkit_source. | 71 MediaStreamVideoCapturerSource* source_; // owned by webkit_source. |
70 scoped_refptr<MockVideoCapturerDelegate> delegate_; | 72 scoped_refptr<MockVideoCapturerDelegate> delegate_; |
71 }; | 73 }; |
72 | 74 |
73 TEST_F(MediaStreamVideoCapturerSourceTest, TabCaptureAllowResolutionChange) { | 75 TEST_F(MediaStreamVideoCapturerSourceTest, TabCaptureAllowResolutionChange) { |
74 StreamDeviceInfo device_info; | 76 StreamDeviceInfo device_info; |
75 device_info.device.type = MEDIA_TAB_VIDEO_CAPTURE; | 77 device_info.device.type = MEDIA_TAB_VIDEO_CAPTURE; |
76 InitWithDeviceInfo(device_info); | 78 InitWithDeviceInfo(device_info); |
(...skipping 16 matching lines...) Expand all Loading... |
93 EXPECT_CALL(*delegate_, StartCapture( | 95 EXPECT_CALL(*delegate_, StartCapture( |
94 testing::Field(&media::VideoCaptureParams::allow_resolution_change, true), | 96 testing::Field(&media::VideoCaptureParams::allow_resolution_change, true), |
95 testing::_, | 97 testing::_, |
96 testing::_)).Times(1); | 98 testing::_)).Times(1); |
97 blink::WebMediaStreamTrack track = StartSource(); | 99 blink::WebMediaStreamTrack track = StartSource(); |
98 // When the track goes out of scope, the source will be stopped. | 100 // When the track goes out of scope, the source will be stopped. |
99 EXPECT_CALL(*delegate_, StopCapture()); | 101 EXPECT_CALL(*delegate_, StopCapture()); |
100 } | 102 } |
101 | 103 |
102 } // namespace content | 104 } // namespace content |
OLD | NEW |