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

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

Issue 1608073002: Revert of Remove MockConstraints (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
11 #include "components/test_runner/web_test_delegate.h" 12 #include "components/test_runner/web_test_delegate.h"
12 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" 13 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
13 #include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h" 14 #include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h"
14 #include "third_party/WebKit/public/platform/WebMediaStream.h" 15 #include "third_party/WebKit/public/platform/WebMediaStream.h"
15 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 16 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
16 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 17 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
17 #include "third_party/WebKit/public/platform/WebMediaStreamTrackSourcesRequest.h " 18 #include "third_party/WebKit/public/platform/WebMediaStreamTrackSourcesRequest.h "
18 #include "third_party/WebKit/public/platform/WebSourceInfo.h" 19 #include "third_party/WebKit/public/platform/WebSourceInfo.h"
19 #include "third_party/WebKit/public/platform/WebVector.h" 20 #include "third_party/WebKit/public/platform/WebVector.h"
20 #include "third_party/WebKit/public/web/WebDocument.h" 21 #include "third_party/WebKit/public/web/WebDocument.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 const WebUserMediaRequest& stream_request) { 139 const WebUserMediaRequest& stream_request) {
139 DCHECK(!stream_request.isNull()); 140 DCHECK(!stream_request.isNull());
140 WebUserMediaRequest request = stream_request; 141 WebUserMediaRequest request = stream_request;
141 142
142 if (request.ownerDocument().isNull() || !request.ownerDocument().frame()) { 143 if (request.ownerDocument().isNull() || !request.ownerDocument().frame()) {
143 delegate_->PostTask( 144 delegate_->PostTask(
144 new UserMediaRequestPermissionDeniedTask(this, request)); 145 new UserMediaRequestPermissionDeniedTask(this, request));
145 return; 146 return;
146 } 147 }
147 148
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
148 WebMediaStream stream; 165 WebMediaStream stream;
149 stream.initialize(WebVector<WebMediaStreamTrack>(), 166 stream.initialize(WebVector<WebMediaStreamTrack>(),
150 WebVector<WebMediaStreamTrack>()); 167 WebVector<WebMediaStreamTrack>());
151 stream.setExtraData(new MockExtraData()); 168 stream.setExtraData(new MockExtraData());
152 169
153 if (request.audio() && 170 if (request.audio() &&
154 !delegate_->AddMediaStreamAudioSourceAndTrack(&stream)) { 171 !delegate_->AddMediaStreamAudioSourceAndTrack(&stream)) {
155 WebMediaStreamSource source; 172 WebMediaStreamSource source;
156 source.initialize("MockAudioDevice#1", 173 source.initialize("MockAudioDevice#1",
157 WebMediaStreamSource::TypeAudio, 174 WebMediaStreamSource::TypeAudio,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 sources[i].initialize(WebString::fromUTF8(test_sources[i].id), 269 sources[i].initialize(WebString::fromUTF8(test_sources[i].id),
253 test_sources[i].kind, 270 test_sources[i].kind,
254 WebString::fromUTF8(test_sources[i].label), 271 WebString::fromUTF8(test_sources[i].label),
255 test_sources[i].facing); 272 test_sources[i].facing);
256 } 273 }
257 274
258 delegate_->PostTask(new SourcesRequestTask(this, request, sources)); 275 delegate_->PostTask(new SourcesRequestTask(this, request, sources));
259 } 276 }
260 277
261 } // namespace test_runner 278 } // 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