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

Side by Side Diff: components/test_runner/mock_web_user_media_client.cc

Issue 1614733002: Reland of Remove MockConstraints (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing tests Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/test_runner/mock_web_user_media_client.h" 5 #include "components/test_runner/mock_web_user_media_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "components/test_runner/mock_constraints.h"
12 #include "components/test_runner/web_test_delegate.h" 11 #include "components/test_runner/web_test_delegate.h"
13 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" 12 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
14 #include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h" 13 #include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h"
15 #include "third_party/WebKit/public/platform/WebMediaStream.h" 14 #include "third_party/WebKit/public/platform/WebMediaStream.h"
16 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 15 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
17 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 16 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
18 #include "third_party/WebKit/public/platform/WebMediaStreamTrackSourcesRequest.h " 17 #include "third_party/WebKit/public/platform/WebMediaStreamTrackSourcesRequest.h "
19 #include "third_party/WebKit/public/platform/WebSourceInfo.h" 18 #include "third_party/WebKit/public/platform/WebSourceInfo.h"
20 #include "third_party/WebKit/public/platform/WebVector.h" 19 #include "third_party/WebKit/public/platform/WebVector.h"
21 #include "third_party/WebKit/public/web/WebDocument.h" 20 #include "third_party/WebKit/public/web/WebDocument.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 const WebUserMediaRequest& stream_request) { 138 const WebUserMediaRequest& stream_request) {
140 DCHECK(!stream_request.isNull()); 139 DCHECK(!stream_request.isNull());
141 WebUserMediaRequest request = stream_request; 140 WebUserMediaRequest request = stream_request;
142 141
143 if (request.ownerDocument().isNull() || !request.ownerDocument().frame()) { 142 if (request.ownerDocument().isNull() || !request.ownerDocument().frame()) {
144 delegate_->PostTask( 143 delegate_->PostTask(
145 new UserMediaRequestPermissionDeniedTask(this, request)); 144 new UserMediaRequestPermissionDeniedTask(this, request));
146 return; 145 return;
147 } 146 }
148 147
149 WebMediaConstraints constraints = request.audioConstraints();
150 WebString failed_constraint;
151 if (!constraints.isNull() &&
152 !MockConstraints::VerifyConstraints(constraints, &failed_constraint)) {
153 delegate_->PostTask(new UserMediaRequestConstraintFailedTask(
154 this, request, failed_constraint));
155 return;
156 }
157 constraints = request.videoConstraints();
158 if (!constraints.isNull() &&
159 !MockConstraints::VerifyConstraints(constraints, &failed_constraint)) {
160 delegate_->PostTask(new UserMediaRequestConstraintFailedTask(
161 this, request, failed_constraint));
162 return;
163 }
164
165 WebMediaStream stream; 148 WebMediaStream stream;
166 stream.initialize(WebVector<WebMediaStreamTrack>(), 149 stream.initialize(WebVector<WebMediaStreamTrack>(),
167 WebVector<WebMediaStreamTrack>()); 150 WebVector<WebMediaStreamTrack>());
168 stream.setExtraData(new MockExtraData()); 151 stream.setExtraData(new MockExtraData());
169 152
170 if (request.audio() && 153 if (request.audio() &&
171 !delegate_->AddMediaStreamAudioSourceAndTrack(&stream)) { 154 !delegate_->AddMediaStreamAudioSourceAndTrack(&stream)) {
172 WebMediaStreamSource source; 155 WebMediaStreamSource source;
173 source.initialize("MockAudioDevice#1", 156 source.initialize("MockAudioDevice#1",
174 WebMediaStreamSource::TypeAudio, 157 WebMediaStreamSource::TypeAudio,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 sources[i].initialize(WebString::fromUTF8(test_sources[i].id), 252 sources[i].initialize(WebString::fromUTF8(test_sources[i].id),
270 test_sources[i].kind, 253 test_sources[i].kind,
271 WebString::fromUTF8(test_sources[i].label), 254 WebString::fromUTF8(test_sources[i].label),
272 test_sources[i].facing); 255 test_sources[i].facing);
273 } 256 }
274 257
275 delegate_->PostTask(new SourcesRequestTask(this, request, sources)); 258 delegate_->PostTask(new SourcesRequestTask(this, request, sources));
276 } 259 }
277 260
278 } // namespace test_runner 261 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/mock_constraints.cc ('k') | components/test_runner/mock_webrtc_peer_connection_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698