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

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

Issue 2710213005: Revert of Remove |remote| and |readonly| members of MediaStreamTrack (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_registry.h" 5 #include "content/renderer/media/mock_media_stream_registry.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/renderer/media/media_stream.h" 10 #include "content/renderer/media/media_stream.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 test_stream_.initialize(label, webkit_audio_tracks, webkit_video_tracks); 54 test_stream_.initialize(label, webkit_audio_tracks, webkit_video_tracks);
55 test_stream_.setExtraData(new MediaStream()); 55 test_stream_.setExtraData(new MediaStream());
56 } 56 }
57 57
58 void MockMediaStreamRegistry::AddVideoTrack( 58 void MockMediaStreamRegistry::AddVideoTrack(
59 const std::string& track_id, 59 const std::string& track_id,
60 const blink::WebMediaConstraints& constraints) { 60 const blink::WebMediaConstraints& constraints) {
61 blink::WebMediaStreamSource blink_source; 61 blink::WebMediaStreamSource blink_source;
62 blink_source.initialize("mock video source id", 62 blink_source.initialize("mock video source id",
63 blink::WebMediaStreamSource::TypeVideo, 63 blink::WebMediaStreamSource::TypeVideo,
64 "mock video source name"); 64 "mock video source name",
65 false /* remote */);
65 MockMediaStreamVideoSource* native_source = 66 MockMediaStreamVideoSource* native_source =
66 new MockMediaStreamVideoSource(false /* manual get supported formats */); 67 new MockMediaStreamVideoSource(false /* manual get supported formats */);
67 blink_source.setExtraData(native_source); 68 blink_source.setExtraData(native_source);
68 blink::WebMediaStreamTrack blink_track; 69 blink::WebMediaStreamTrack blink_track;
69 blink_track.initialize(blink::WebString::fromUTF8(track_id), blink_source); 70 blink_track.initialize(blink::WebString::fromUTF8(track_id), blink_source);
70 71
71 MediaStreamVideoTrack* native_track = new MediaStreamVideoTrack( 72 MediaStreamVideoTrack* native_track = new MediaStreamVideoTrack(
72 native_source, constraints, MediaStreamVideoSource::ConstraintsCallback(), 73 native_source, constraints, MediaStreamVideoSource::ConstraintsCallback(),
73 true /* enabled */); 74 true /* enabled */);
74 blink_track.setTrackData(native_track); 75 blink_track.setTrackData(native_track);
75 test_stream_.addTrack(blink_track); 76 test_stream_.addTrack(blink_track);
76 } 77 }
77 78
78 void MockMediaStreamRegistry::AddVideoTrack(const std::string& track_id) { 79 void MockMediaStreamRegistry::AddVideoTrack(const std::string& track_id) {
79 blink::WebMediaConstraints constraints; 80 blink::WebMediaConstraints constraints;
80 constraints.initialize(); 81 constraints.initialize();
81 AddVideoTrack(track_id, constraints); 82 AddVideoTrack(track_id, constraints);
82 } 83 }
83 84
84 void MockMediaStreamRegistry::AddAudioTrack(const std::string& track_id) { 85 void MockMediaStreamRegistry::AddAudioTrack(const std::string& track_id) {
85 blink::WebMediaStreamSource blink_source; 86 blink::WebMediaStreamSource blink_source;
86 blink_source.initialize("mock audio source id", 87 blink_source.initialize(
87 blink::WebMediaStreamSource::TypeAudio, 88 "mock audio source id", blink::WebMediaStreamSource::TypeAudio,
88 "mock audio source name"); 89 "mock audio source name", false /* remote */);
89 MediaStreamAudioSource* const source = new MockCDQualityAudioSource(); 90 MediaStreamAudioSource* const source = new MockCDQualityAudioSource();
90 blink_source.setExtraData(source); // Takes ownership. 91 blink_source.setExtraData(source); // Takes ownership.
91 92
92 blink::WebMediaStreamTrack blink_track; 93 blink::WebMediaStreamTrack blink_track;
93 blink_track.initialize(blink_source); 94 blink_track.initialize(blink_source);
94 CHECK(source->ConnectToTrack(blink_track)); 95 CHECK(source->ConnectToTrack(blink_track));
95 96
96 test_stream_.addTrack(blink_track); 97 test_stream_.addTrack(blink_track);
97 } 98 }
98 99
99 blink::WebMediaStream MockMediaStreamRegistry::GetMediaStream( 100 blink::WebMediaStream MockMediaStreamRegistry::GetMediaStream(
100 const std::string& url) { 101 const std::string& url) {
101 return (url != stream_url_) ? blink::WebMediaStream() : test_stream_; 102 return (url != stream_url_) ? blink::WebMediaStream() : test_stream_;
102 } 103 }
103 104
104 } // namespace content 105 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_video_track_unittest.cc ('k') | content/renderer/media/pepper_to_video_track_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698