OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 #include <queue> | 6 #include <queue> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 render_frame_id, page_request_id, type, security_origin); | 108 render_frame_id, page_request_id, type, security_origin); |
109 } | 109 } |
110 | 110 |
111 std::string label_; | 111 std::string label_; |
112 StreamDeviceInfoArray audio_devices_; | 112 StreamDeviceInfoArray audio_devices_; |
113 StreamDeviceInfoArray video_devices_; | 113 StreamDeviceInfoArray video_devices_; |
114 StreamDeviceInfo opened_device_; | 114 StreamDeviceInfo opened_device_; |
115 StreamDeviceInfoArray enumerated_devices_; | 115 StreamDeviceInfoArray enumerated_devices_; |
116 | 116 |
117 private: | 117 private: |
118 virtual ~MockMediaStreamDispatcherHost() {} | 118 ~MockMediaStreamDispatcherHost() override {} |
119 | 119 |
120 // This method is used to dispatch IPC messages to the renderer. We intercept | 120 // This method is used to dispatch IPC messages to the renderer. We intercept |
121 // these messages here and dispatch to our mock methods to verify the | 121 // these messages here and dispatch to our mock methods to verify the |
122 // conversation between this object and the renderer. | 122 // conversation between this object and the renderer. |
123 virtual bool Send(IPC::Message* message) override { | 123 bool Send(IPC::Message* message) override { |
124 CHECK(message); | 124 CHECK(message); |
125 current_ipc_ = message; | 125 current_ipc_ = message; |
126 | 126 |
127 // In this method we dispatch the messages to the according handlers as if | 127 // In this method we dispatch the messages to the according handlers as if |
128 // we are the renderer. | 128 // we are the renderer. |
129 bool handled = true; | 129 bool handled = true; |
130 IPC_BEGIN_MESSAGE_MAP(MockMediaStreamDispatcherHost, *message) | 130 IPC_BEGIN_MESSAGE_MAP(MockMediaStreamDispatcherHost, *message) |
131 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerated, | 131 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerated, |
132 OnStreamGeneratedInternal) | 132 OnStreamGeneratedInternal) |
133 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerationFailed, | 133 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerationFailed, |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 | 918 |
919 TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccess) { | 919 TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccess) { |
920 SetupFakeUI(false); | 920 SetupFakeUI(false); |
921 stream_ui_->SetCameraAccess(false); | 921 stream_ui_->SetCameraAccess(false); |
922 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId, | 922 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId, |
923 MEDIA_DEVICE_VIDEO_CAPTURE); | 923 MEDIA_DEVICE_VIDEO_CAPTURE); |
924 EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_)); | 924 EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_)); |
925 } | 925 } |
926 | 926 |
927 }; // namespace content | 927 }; // namespace content |
OLD | NEW |