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

Side by Side Diff: content/shell/renderer/layout_test/blink_test_runner.cc

Issue 2623443002: Fix getUserMedia so that failure is reported for invalid audio sources. (Closed)
Patch Set: Address comments Created 3 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 (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/shell/renderer/layout_test/blink_test_runner.h" 5 #include "content/shell/renderer/layout_test/blink_test_runner.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <clocale> 10 #include <clocale>
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 void StopCapture() override {} 202 void StopCapture() override {}
203 }; 203 };
204 204
205 class MockAudioCapturerSource : public media::AudioCapturerSource { 205 class MockAudioCapturerSource : public media::AudioCapturerSource {
206 public: 206 public:
207 MockAudioCapturerSource() = default; 207 MockAudioCapturerSource() = default;
208 208
209 void Initialize(const media::AudioParameters& params, 209 void Initialize(const media::AudioParameters& params,
210 CaptureCallback* callback, 210 CaptureCallback* callback,
211 int session_id) override {} 211 int session_id) override {
212 void Start() override {} 212 callback_ = callback;
213 }
214 void Start() override {
215 if (callback_)
216 callback_->OnCaptureStarted();
217 }
213 void Stop() override {} 218 void Stop() override {}
214 void SetVolume(double volume) override {} 219 void SetVolume(double volume) override {}
215 void SetAutomaticGainControl(bool enable) override {} 220 void SetAutomaticGainControl(bool enable) override {}
216 221
217 protected: 222 protected:
218 ~MockAudioCapturerSource() override {} 223 ~MockAudioCapturerSource() override {}
224
225 private:
226 CaptureCallback* callback_ = nullptr;
227
228 DISALLOW_COPY_AND_ASSIGN(MockAudioCapturerSource);
219 }; 229 };
220 230
221 // Tests in web-platform-tests use absolute path links such as 231 // Tests in web-platform-tests use absolute path links such as
222 // <script src="/resources/testharness.js">. 232 // <script src="/resources/testharness.js">.
223 // Because we load the tests as local files, such links don't work. 233 // Because we load the tests as local files, such links don't work.
224 // This function fixes this issue by rewriting file: URLs which were produced 234 // This function fixes this issue by rewriting file: URLs which were produced
225 // from such links so that they point actual files in wpt/. 235 // from such links so that they point actual files in wpt/.
226 WebURL RewriteAbsolutePathInWPT(const std::string& utf8_url) { 236 WebURL RewriteAbsolutePathInWPT(const std::string& utf8_url) {
227 const char kFileScheme[] = "file:///"; 237 const char kFileScheme[] = "file:///";
228 const int kFileSchemeLen = arraysize(kFileScheme) - 1; 238 const int kFileSchemeLen = arraysize(kFileScheme) - 1;
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 void BlinkTestRunner::ReportLeakDetectionResult( 1041 void BlinkTestRunner::ReportLeakDetectionResult(
1032 const LeakDetectionResult& report) { 1042 const LeakDetectionResult& report) {
1033 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 1043 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
1034 } 1044 }
1035 1045
1036 void BlinkTestRunner::OnDestruct() { 1046 void BlinkTestRunner::OnDestruct() {
1037 delete this; 1047 delete this;
1038 } 1048 }
1039 1049
1040 } // namespace content 1050 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc/webrtc_media_stream_adapter_unittest.cc ('k') | media/audio/audio_input_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698