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

Side by Side Diff: components/test_runner/renderer/mock_video_capturer_source.cc

Issue 1371373002: Extend components/test_runner's generated WebMediaStream to have a ChromeMock VideoTrack and Source (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mazzoni@ comments, web_view/test_runner build, rebase, cleaned up requestUserMedia() Created 5 years, 2 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/test_runner/renderer/mock_video_capturer_source.h"
6
7 #if defined(ENABLE_WEBRTC)
8
9 #include "content/public/renderer/media_stream_api.h"
10
11 #else
12
13 #include "third_party/WebKit/public/platform/WebMediaStream.h"
14 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
16 #include "third_party/WebKit/public/platform/WebString.h"
17
18 #endif
19
20 #if defined(ENABLE_WEBRTC)
21
22 namespace {
23
24 class MockVideoCapturerSource : public media::VideoCapturerSource {
25 public:
26 MockVideoCapturerSource() = default;
27 ~MockVideoCapturerSource() override {}
28
29 void GetCurrentSupportedFormats(
30 int max_requested_width,
31 int max_requested_height,
32 double max_requested_frame_rate,
33 const VideoCaptureDeviceFormatsCB& callback) override {}
34 void StartCapture(
35 const media::VideoCaptureParams& params,
36 const VideoCaptureDeliverFrameCB& new_frame_callback,
37 const RunningCallback& running_callback) override {}
38 void StopCapture() override {}
39 };
40
41 } // namespace anonymous
42
43 #endif
44
45 namespace test_runner {
46
47 void AddVideoTrackToMediaStream(blink::WebMediaStream* stream) {
48 #if defined(ENABLE_WEBRTC)
49 content::AddVideoTrackToMediaStream(
50 make_scoped_ptr(new MockVideoCapturerSource()),
51 false /*is _remote */,
52 true /* is_readonly */,
53 stream);
54 #else
55 blink::WebMediaStreamSource source;
56 source.initialize("MockVideoDevice#1",
57 blink::WebMediaStreamSource::TypeVideo,
58 "Mock video device",
59 false /* remote */,
60 true /* readonly */);
61 blink::WebMediaStreamTrack web_track;
62 web_track.initialize(source);
63 stream->addTrack(web_track);
64 #endif
65 }
66
67 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698