Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(690)

Side by Side Diff: content/renderer/media/mock_media_stream_dispatcher.cc

Issue 1928493002: Use url::Origin to represent security origins in MediaStream-related code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/renderer/media/mock_media_stream_dispatcher.h" 5 #include "content/renderer/media/mock_media_stream_dispatcher.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "content/public/common/media_stream_request.h" 8 #include "content/public/common/media_stream_request.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 13 matching lines...) Expand all
24 stop_video_device_counter_(0), 24 stop_video_device_counter_(0),
25 session_id_(0), 25 session_id_(0),
26 test_same_id_(false) {} 26 test_same_id_(false) {}
27 27
28 MockMediaStreamDispatcher::~MockMediaStreamDispatcher() {} 28 MockMediaStreamDispatcher::~MockMediaStreamDispatcher() {}
29 29
30 void MockMediaStreamDispatcher::GenerateStream( 30 void MockMediaStreamDispatcher::GenerateStream(
31 int request_id, 31 int request_id,
32 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, 32 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler,
33 const StreamControls& controls, 33 const StreamControls& controls,
34 const GURL& url) { 34 const url::Origin& url) {
35 // Audio and video share the same request so we use |audio_input_request_id_| 35 // Audio and video share the same request so we use |audio_input_request_id_|
36 // only. 36 // only.
37 audio_input_request_id_ = request_id; 37 audio_input_request_id_ = request_id;
38 38
39 stream_label_ = "local_stream" + base::IntToString(request_id); 39 stream_label_ = "local_stream" + base::IntToString(request_id);
40 audio_input_array_.clear(); 40 audio_input_array_.clear();
41 video_array_.clear(); 41 video_array_.clear();
42 42
43 if (controls.audio.requested) { 43 if (controls.audio.requested) {
44 AddAudioInputDeviceToArray(false); 44 AddAudioInputDeviceToArray(false);
45 } 45 }
46 if (controls.video.requested) { 46 if (controls.video.requested) {
47 AddVideoDeviceToArray(true); 47 AddVideoDeviceToArray(true);
48 } 48 }
49 ++request_stream_counter_; 49 ++request_stream_counter_;
50 } 50 }
51 51
52 void MockMediaStreamDispatcher::CancelGenerateStream( 52 void MockMediaStreamDispatcher::CancelGenerateStream(
53 int request_id, 53 int request_id,
54 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler) { 54 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler) {
55 EXPECT_EQ(request_id, audio_input_request_id_); 55 EXPECT_EQ(request_id, audio_input_request_id_);
56 } 56 }
57 57
58 void MockMediaStreamDispatcher::EnumerateDevices( 58 void MockMediaStreamDispatcher::EnumerateDevices(
59 int request_id, 59 int request_id,
60 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, 60 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler,
61 MediaStreamType type, 61 MediaStreamType type,
62 const GURL& security_origin) { 62 const url::Origin& security_origin) {
63 if (type == MEDIA_DEVICE_AUDIO_CAPTURE) { 63 if (type == MEDIA_DEVICE_AUDIO_CAPTURE) {
64 audio_input_request_id_ = request_id; 64 audio_input_request_id_ = request_id;
65 audio_input_array_.clear(); 65 audio_input_array_.clear();
66 AddAudioInputDeviceToArray(true); 66 AddAudioInputDeviceToArray(true);
67 AddAudioInputDeviceToArray(false); 67 AddAudioInputDeviceToArray(false);
68 } else if (type == MEDIA_DEVICE_AUDIO_OUTPUT) { 68 } else if (type == MEDIA_DEVICE_AUDIO_OUTPUT) {
69 audio_output_request_id_ = request_id; 69 audio_output_request_id_ = request_id;
70 audio_output_array_.clear(); 70 audio_output_array_.clear();
71 AddAudioOutputDeviceToArray(); 71 AddAudioOutputDeviceToArray();
72 } else if (type == MEDIA_DEVICE_VIDEO_CAPTURE) { 72 } else if (type == MEDIA_DEVICE_VIDEO_CAPTURE) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 video.device.id = video.device.id + base::IntToString(session_id_); 136 video.device.id = video.device.id + base::IntToString(session_id_);
137 video.device.name = "usb video camera"; 137 video.device.name = "usb video camera";
138 video.device.type = MEDIA_DEVICE_VIDEO_CAPTURE; 138 video.device.type = MEDIA_DEVICE_VIDEO_CAPTURE;
139 video.device.video_facing = facing_user ? MEDIA_VIDEO_FACING_USER 139 video.device.video_facing = facing_user ? MEDIA_VIDEO_FACING_USER
140 : MEDIA_VIDEO_FACING_ENVIRONMENT; 140 : MEDIA_VIDEO_FACING_ENVIRONMENT;
141 video.session_id = session_id_; 141 video.session_id = session_id_;
142 video_array_.push_back(video); 142 video_array_.push_back(video);
143 } 143 }
144 144
145 } // namespace content 145 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/mock_media_stream_dispatcher.h ('k') | content/renderer/media/user_media_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698