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

Side by Side Diff: ppapi/tests/test_video_destination.cc

Issue 2365883002: Expose the MediaStream interface (Closed)
Patch Set: drop TODO Created 4 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
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 // Tests PPB_VideoDestination_Private interface. 5 // Tests PPB_VideoDestination_Private interface.
6 6
7 #include "ppapi/tests/test_video_destination.h" 7 #include "ppapi/tests/test_video_destination.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Once released, the resource shouldn't be a video destination. 93 // Once released, the resource shouldn't be a video destination.
94 ASSERT_FALSE( 94 ASSERT_FALSE(
95 ppb_video_destination_private_interface_->IsVideoDestination( 95 ppb_video_destination_private_interface_->IsVideoDestination(
96 video_destination)); 96 video_destination));
97 97
98 PASS(); 98 PASS();
99 } 99 }
100 100
101 std::string TestVideoDestination::TestPutFrame() { 101 std::string TestVideoDestination::TestPutFrame() {
102 std::string js_code; 102 std::string js_code;
103 js_code += "var test_stream = new webkitMediaStream([]);" 103 js_code += "var test_stream = new MediaStream([]);"
104 "var url = URL.createObjectURL(test_stream);" 104 "var url = URL.createObjectURL(test_stream);"
105 "var plugin = document.getElementById('plugin');" 105 "var plugin = document.getElementById('plugin');"
106 "plugin.postMessage(url);"; 106 "plugin.postMessage(url);";
107 instance_->EvalScript(js_code); 107 instance_->EvalScript(js_code);
108 event_.Wait(); 108 event_.Wait();
109 109
110 pp::VideoDestination_Private video_destination(instance_); 110 pp::VideoDestination_Private video_destination(instance_);
111 TestCompletionCallback cc1(instance_->pp_instance(), false); 111 TestCompletionCallback cc1(instance_->pp_instance(), false);
112 cc1.WaitForResult(video_destination.Open(stream_url_, cc1.GetCallback())); 112 cc1.WaitForResult(video_destination.Open(stream_url_, cc1.GetCallback()));
113 ASSERT_EQ(PP_OK, cc1.result()); 113 ASSERT_EQ(PP_OK, cc1.result());
114 114
115 pp::ImageData image_data(instance_, 115 pp::ImageData image_data(instance_,
116 PP_IMAGEDATAFORMAT_BGRA_PREMUL, 116 PP_IMAGEDATAFORMAT_BGRA_PREMUL,
117 pp::Size(640, 480), 117 pp::Size(640, 480),
118 false /* init_to_zero */); 118 false /* init_to_zero */);
119 pp::VideoFrame_Private video_frame(image_data, 119 pp::VideoFrame_Private video_frame(image_data,
120 0.0 /* timestamp */); 120 0.0 /* timestamp */);
121 ASSERT_EQ(PP_OK, video_destination.PutFrame(video_frame)); 121 ASSERT_EQ(PP_OK, video_destination.PutFrame(video_frame));
122 122
123 video_destination.Close(); 123 video_destination.Close();
124 124
125 PASS(); 125 PASS();
126 } 126 }
127
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698