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

Side by Side Diff: content/renderer/media/media_stream_video_source_unittest.cc

Issue 129923002: Implements MediaStreamVideoSource. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 <string> 5 #include <string>
6 6
7 #include "content/renderer/media/media_stream_video_source.h" 7 #include "content/renderer/media/media_stream_video_source.h"
8 #include "content/renderer/media/mock_media_stream_dependency_factory.h"
8 #include "media/base/video_frame.h" 9 #include "media/base/video_frame.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace content { 12 namespace content {
12 13
13 class MediaStreamVideoSourceTest 14 class MediaStreamVideoSourceTest
14 : public ::testing::Test, 15 : public ::testing::Test,
15 public MediaStreamVideoSource { 16 public MediaStreamVideoSource {
16 public: 17 public:
17 MediaStreamVideoSourceTest() {} 18 MediaStreamVideoSourceTest() {
19 SetMsFactory(&factory_);
20 }
21
22 private:
23 MockMediaStreamDependencyFactory factory_;
18 }; 24 };
19 25
20 TEST_F(MediaStreamVideoSourceTest, OnVideoFrame) { 26 TEST_F(MediaStreamVideoSourceTest, OnVideoFrame) {
21 blink::WebMediaConstraints constraints; 27 blink::WebMediaConstraints constraints;
22 blink::WebMediaStreamTrack track; 28 blink::WebMediaStreamTrack track;
23 AddTrack(track, constraints); 29 AddTrack(track, constraints);
24 SetReadyState(blink::WebMediaStreamSource::ReadyStateLive); 30 SetReadyState(blink::WebMediaStreamSource::ReadyStateLive);
25 const int kWidth = 640; 31 const int kWidth = 640;
26 const int kHeight = 480; 32 const int kHeight = 480;
27 scoped_refptr<media::VideoFrame> frame = 33 scoped_refptr<media::VideoFrame> frame =
28 media::VideoFrame::CreateBlackFrame(gfx::Size(kWidth, kHeight)); 34 media::VideoFrame::CreateBlackFrame(gfx::Size(kWidth, kHeight));
29 ASSERT_TRUE(frame.get()); 35 ASSERT_TRUE(frame.get());
30 DeliverVideoFrame(frame); 36 DeliverVideoFrame(frame);
31 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); 37 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded);
32 RemoveTrack(track); 38 RemoveTrack(track);
33 } 39 }
34 40
35 } // namespace content 41 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698