Content settings: remove some plugin-related code/resources when... there are no...
[chromium-blink-merge.git] / content / shell / renderer / layout_test / test_media_stream_renderer_factory.cc
blob0c07c5ae6853037520e7b1957fdce3d2f520e297
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
3 // found in the LICENSE file.
5 #include "content/shell/renderer/layout_test/test_media_stream_renderer_factory.h"
7 #include "content/shell/renderer/layout_test/test_video_frame_provider.h"
8 #include "third_party/WebKit/public/platform/WebMediaStream.h"
9 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
10 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h"
11 #include "url/gurl.h"
13 using namespace blink;
15 namespace {
17 static const int kVideoCaptureWidth = 352;
18 static const int kVideoCaptureHeight = 288;
19 static const int kVideoCaptureFrameDurationMs = 33;
21 bool IsMockMediaStreamWithVideo(const WebURL& url) {
22 #if ENABLE_WEBRTC
23 WebMediaStream descriptor(
24 WebMediaStreamRegistry::lookupMediaStreamDescriptor(url));
25 if (descriptor.isNull())
26 return false;
27 WebVector<WebMediaStreamTrack> video_tracks;
28 descriptor.videoTracks(video_tracks);
29 return video_tracks.size() > 0;
30 #else
31 return false;
32 #endif
35 } // namespace
37 namespace content {
39 TestMediaStreamRendererFactory::TestMediaStreamRendererFactory() {}
41 TestMediaStreamRendererFactory::~TestMediaStreamRendererFactory() {}
43 scoped_refptr<VideoFrameProvider>
44 TestMediaStreamRendererFactory::GetVideoFrameProvider(
45 const GURL& url,
46 const base::Closure& error_cb,
47 const VideoFrameProvider::RepaintCB& repaint_cb) {
48 if (!IsMockMediaStreamWithVideo(url))
49 return NULL;
51 return new TestVideoFrameProvider(
52 gfx::Size(kVideoCaptureWidth, kVideoCaptureHeight),
53 base::TimeDelta::FromMilliseconds(kVideoCaptureFrameDurationMs),
54 error_cb,
55 repaint_cb);
58 scoped_refptr<MediaStreamAudioRenderer>
59 TestMediaStreamRendererFactory::GetAudioRenderer(const GURL& url,
60 int render_frame_id) {
61 return NULL;
64 } // namespace content