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

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

Issue 180633008: Add different error codes for getUserMedia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments Created 6 years, 9 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 | Annotate | Revision Log
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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "content/common/media/media_stream_options.h" 6 #include "content/common/media/media_stream_options.h"
7 #include "content/renderer/media/media_stream.h" 7 #include "content/renderer/media/media_stream.h"
8 #include "content/renderer/media/media_stream_audio_source.h" 8 #include "content/renderer/media/media_stream_audio_source.h"
9 #include "content/renderer/media/media_stream_video_source.h" 9 #include "content/renderer/media/media_stream_video_source.h"
10 #include "content/renderer/media/media_stream_video_track.h" 10 #include "content/renderer/media/media_stream_video_track.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 blink::WebMediaStream CreateWebKitMediaStream(bool audio, bool video) { 55 blink::WebMediaStream CreateWebKitMediaStream(bool audio, bool video) {
56 blink::WebVector<blink::WebMediaStreamSource> audio_sources( 56 blink::WebVector<blink::WebMediaStreamSource> audio_sources(
57 audio ? static_cast<size_t>(1) : 0); 57 audio ? static_cast<size_t>(1) : 0);
58 blink::WebVector<blink::WebMediaStreamSource> video_sources( 58 blink::WebVector<blink::WebMediaStreamSource> video_sources(
59 video ? static_cast<size_t>(1) : 0); 59 video ? static_cast<size_t>(1) : 0);
60 MediaStreamSource::SourceStoppedCallback dummy_callback; 60 MediaStreamSource::SourceStoppedCallback dummy_callback;
61 61
62 if (audio) { 62 if (audio) {
63 StreamDeviceInfo info; 63 StreamDeviceInfo info;
64 info.device.type = content::MEDIA_DEVICE_AUDIO_CAPTURE; 64 info.device.type = MEDIA_DEVICE_AUDIO_CAPTURE;
65 info.device.name = "audio"; 65 info.device.name = "audio";
66 info.session_id = 99; 66 info.session_id = 99;
67 audio_sources[0].initialize("audio", 67 audio_sources[0].initialize("audio",
68 blink::WebMediaStreamSource::TypeAudio, 68 blink::WebMediaStreamSource::TypeAudio,
69 "audio"); 69 "audio");
70 audio_sources[0].setExtraData( 70 audio_sources[0].setExtraData(
71 new MediaStreamAudioSource()); 71 new MediaStreamAudioSource());
72 72
73 audio_sources_.assign(audio_sources); 73 audio_sources_.assign(audio_sources);
74 } 74 }
75 if (video) { 75 if (video) {
76 StreamDeviceInfo info; 76 StreamDeviceInfo info;
77 info.device.type = content::MEDIA_DEVICE_VIDEO_CAPTURE; 77 info.device.type = MEDIA_DEVICE_VIDEO_CAPTURE;
78 info.device.name = "video"; 78 info.device.name = "video";
79 info.session_id = 98; 79 info.session_id = 98;
80 video_sources[0].initialize("video", 80 video_sources[0].initialize("video",
81 blink::WebMediaStreamSource::TypeVideo, 81 blink::WebMediaStreamSource::TypeVideo,
82 "video"); 82 "video");
83 83
84 video_sources[0].setExtraData( 84 video_sources[0].setExtraData(
85 new MockMediaStreamVideoSource(dependency_factory_.get(), false)); 85 new MockMediaStreamVideoSource(dependency_factory_.get(), false));
86 video_sources_.assign(video_sources); 86 video_sources_.assign(video_sources);
87 } 87 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 EXPECT_TRUE(dependency_factory_->RemoveNativeMediaStreamTrack( 203 EXPECT_TRUE(dependency_factory_->RemoveNativeMediaStreamTrack(
204 stream_desc, video_tracks[0])); 204 stream_desc, video_tracks[0]));
205 VerifyMediaStream(stream_desc, 1, 0); 205 VerifyMediaStream(stream_desc, 1, 0);
206 206
207 EXPECT_TRUE(dependency_factory_->AddNativeMediaStreamTrack( 207 EXPECT_TRUE(dependency_factory_->AddNativeMediaStreamTrack(
208 stream_desc, video_tracks[0])); 208 stream_desc, video_tracks[0]));
209 VerifyMediaStream(stream_desc, 1, 1); 209 VerifyMediaStream(stream_desc, 1, 1);
210 } 210 }
211 211
212 } // namespace content 212 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/media_stream_request.cc ('k') | content/renderer/media/media_stream_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698