| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/child/child_process.h" | 10 #include "content/child/child_process.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; | 71 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; |
| 72 test_stream.videoTracks(video_tracks); | 72 test_stream.videoTracks(video_tracks); |
| 73 ASSERT_EQ(1u, video_tracks.size()); | 73 ASSERT_EQ(1u, video_tracks.size()); |
| 74 | 74 |
| 75 // Verify the native video track has been added. | 75 // Verify the native video track has been added. |
| 76 MediaStreamVideoTrack* native_track = | 76 MediaStreamVideoTrack* native_track = |
| 77 MediaStreamVideoTrack::GetVideoTrack(video_tracks[0]); | 77 MediaStreamVideoTrack::GetVideoTrack(video_tracks[0]); |
| 78 ASSERT_TRUE(native_track != NULL); | 78 ASSERT_TRUE(native_track != NULL); |
| 79 | 79 |
| 80 MockMediaStreamVideoSink sink; | 80 MockMediaStreamVideoSink sink; |
| 81 native_track->AddSink(&sink); | 81 native_track->AddSink(&sink, sink.GetDeliverFrameCB()); |
| 82 | 82 scoped_refptr<PPB_ImageData_Impl> image( |
| 83 scoped_refptr<PPB_ImageData_Impl> image( | |
| 84 new PPB_ImageData_Impl(instance()->pp_instance(), | 83 new PPB_ImageData_Impl(instance()->pp_instance(), |
| 85 PPB_ImageData_Impl::ForTest())); | 84 PPB_ImageData_Impl::ForTest())); |
| 86 image->Init(PP_IMAGEDATAFORMAT_BGRA_PREMUL, 640, 360, true); | 85 image->Init(PP_IMAGEDATAFORMAT_BGRA_PREMUL, 640, 360, true); |
| 87 { | 86 { |
| 88 base::RunLoop run_loop; | 87 base::RunLoop run_loop; |
| 89 base::Closure quit_closure = run_loop.QuitClosure(); | 88 base::Closure quit_closure = run_loop.QuitClosure(); |
| 90 | 89 |
| 91 EXPECT_CALL(sink, OnVideoFrame()).WillOnce( | 90 EXPECT_CALL(sink, OnVideoFrame()).WillOnce( |
| 92 RunClosure(quit_closure)); | 91 RunClosure(quit_closure)); |
| 93 frame_writer->PutFrame(image, 10); | 92 frame_writer->PutFrame(image, 10); |
| 94 run_loop.Run(); | 93 run_loop.Run(); |
| 95 } | 94 } |
| 96 // TODO(perkj): Verify that the track output I420 when | 95 // TODO(perkj): Verify that the track output I420 when |
| 97 // https://codereview.chromium.org/213423006/ is landed. | 96 // https://codereview.chromium.org/213423006/ is landed. |
| 98 EXPECT_EQ(1, sink.number_of_frames()); | 97 EXPECT_EQ(1, sink.number_of_frames()); |
| 99 native_track->RemoveSink(&sink); | 98 native_track->RemoveSink(&sink); |
| 100 | 99 |
| 101 // The |frame_writer| is a proxy and is owned by whoever call Open. | 100 // The |frame_writer| is a proxy and is owned by whoever call Open. |
| 102 delete frame_writer; | 101 delete frame_writer; |
| 103 } | 102 } |
| 104 | 103 |
| 105 } // namespace content | 104 } // namespace content |
| OLD | NEW |