OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/renderer/media/media_devices_event_dispatcher.h" | 5 #include "content/renderer/media/media_devices_event_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 MOCK_METHOD2(EventDispatched, | 29 MOCK_METHOD2(EventDispatched, |
30 void(MediaDeviceType, const MediaDeviceInfoArray&)); | 30 void(MediaDeviceType, const MediaDeviceInfoArray&)); |
31 }; | 31 }; |
32 | 32 |
33 class MockMediaDevicesDispatcherHost | 33 class MockMediaDevicesDispatcherHost |
34 : public ::mojom::MediaDevicesDispatcherHost { | 34 : public ::mojom::MediaDevicesDispatcherHost { |
35 public: | 35 public: |
36 MockMediaDevicesDispatcherHost() : binding_(this) {} | 36 MockMediaDevicesDispatcherHost() : binding_(this) {} |
37 | 37 |
38 MOCK_METHOD5(EnumerateDevices, | |
39 void(bool request_audio_input, | |
40 bool request_video_input, | |
41 bool request_audio_output, | |
42 const url::Origin& security_origin, | |
43 const EnumerateDevicesCallback& callback)); | |
44 MOCK_METHOD3(SubscribeDeviceChangeNotifications, | 38 MOCK_METHOD3(SubscribeDeviceChangeNotifications, |
45 void(MediaDeviceType type, | 39 void(MediaDeviceType type, |
46 uint32_t subscription_id, | 40 uint32_t subscription_id, |
47 const url::Origin& security_origin)); | 41 const url::Origin& security_origin)); |
48 MOCK_METHOD2(UnsubscribeDeviceChangeNotifications, | 42 MOCK_METHOD2(UnsubscribeDeviceChangeNotifications, |
49 void(MediaDeviceType type, uint32_t subscription_id)); | 43 void(MediaDeviceType type, uint32_t subscription_id)); |
50 MOCK_METHOD2(GetVideoInputCapabilities, | 44 |
51 void(const url::Origin& security_origin, | 45 void EnumerateDevices(bool request_audio_input, |
52 const GetVideoInputCapabilitiesCallback& client_callback)); | 46 bool request_video_input, |
| 47 bool request_audio_output, |
| 48 const url::Origin& security_origin, |
| 49 EnumerateDevicesCallback) override { |
| 50 NOTREACHED(); |
| 51 } |
| 52 |
| 53 void GetVideoInputCapabilities( |
| 54 const url::Origin& security_origin, |
| 55 GetVideoInputCapabilitiesCallback client_callback) override { |
| 56 NOTREACHED(); |
| 57 } |
53 | 58 |
54 ::mojom::MediaDevicesDispatcherHostPtr CreateInterfacePtrAndBind() { | 59 ::mojom::MediaDevicesDispatcherHostPtr CreateInterfacePtrAndBind() { |
55 return binding_.CreateInterfacePtrAndBind(); | 60 return binding_.CreateInterfacePtrAndBind(); |
56 } | 61 } |
57 | 62 |
58 private: | 63 private: |
59 mojo::Binding<::mojom::MediaDevicesDispatcherHost> binding_; | 64 mojo::Binding<::mojom::MediaDevicesDispatcherHost> binding_; |
60 }; | 65 }; |
61 | 66 |
62 class MediaDevicesEventDispatcherTest : public ::testing::Test { | 67 class MediaDevicesEventDispatcherTest : public ::testing::Test { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 MediaDeviceType type = static_cast<MediaDeviceType>(i); | 192 MediaDeviceType type = static_cast<MediaDeviceType>(i); |
188 EXPECT_CALL( | 193 EXPECT_CALL( |
189 media_devices_dispatcher_, | 194 media_devices_dispatcher_, |
190 UnsubscribeDeviceChangeNotifications(type, subscription_list_2[type])); | 195 UnsubscribeDeviceChangeNotifications(type, subscription_list_2[type])); |
191 } | 196 } |
192 event_dispatcher_->UnsubscribeDeviceChangeNotifications(subscription_list_2); | 197 event_dispatcher_->UnsubscribeDeviceChangeNotifications(subscription_list_2); |
193 base::RunLoop().RunUntilIdle(); | 198 base::RunLoop().RunUntilIdle(); |
194 } | 199 } |
195 | 200 |
196 } // namespace content | 201 } // namespace content |
OLD | NEW |