Index: ppapi/tests/test_video_encoder.cc |
diff --git a/ppapi/tests/test_video_encoder.cc b/ppapi/tests/test_video_encoder.cc |
index 4737ed0fc72b037545ee7dbe121ff86bbd7ae39f..fe4507f8121522f8317cbcd707c3a4829bb7c20b 100644 |
--- a/ppapi/tests/test_video_encoder.cc |
+++ b/ppapi/tests/test_video_encoder.cc |
@@ -32,10 +32,56 @@ std::string TestVideoEncoder::TestCreate() { |
callback.WaitForResult( |
video_encoder.GetSupportedProfiles(callback.GetCallback())); |
- ASSERT_GE(callback.output().size(), 0U); |
+ ASSERT_EQ(PP_OK, callback.result()); |
+ ASSERT_GE(callback.output().size(), 1U); |
+ |
+ bool found_vp8 = false; |
+ for (uint32_t i = 0; i < callback.output().size(); ++i) { |
+ const PP_VideoProfileDescription& description = callback.output()[i]; |
+ if (description.profile == PP_VIDEOPROFILE_VP8_ANY) |
+ found_vp8 = true; |
+ } |
+ ASSERT_TRUE(found_vp8); |
+ } |
+ // Test that initializing the encoder with incorrect size fails. |
+ { |
+ pp::VideoEncoder video_encoder(instance_); |
+ ASSERT_FALSE(video_encoder.is_null()); |
+ pp::Size video_size(0, 0); |
+ |
+ TestCompletionCallback callback(instance_->pp_instance(), false); |
+ callback.WaitForResult( |
+ video_encoder.Initialize(PP_VIDEOFRAME_FORMAT_I420, |
+ video_size, |
+ PP_VIDEOPROFILE_VP8_ANY, |
+ 1000000, |
+ PP_HARDWAREACCELERATION_WITHFALLBACK, |
+ callback.GetCallback())); |
+ |
+ ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result()); |
+ } |
+ // Test that initializing the encoder with software VP8 succeeds. |
+ { |
+ pp::VideoEncoder video_encoder(instance_); |
+ ASSERT_FALSE(video_encoder.is_null()); |
+ pp::Size video_size(640, 480); |
+ |
+ TestCompletionCallback callback(instance_->pp_instance(), false); |
+ callback.WaitForResult( |
+ video_encoder.Initialize(PP_VIDEOFRAME_FORMAT_I420, |
+ video_size, |
+ PP_VIDEOPROFILE_VP8_ANY, |
+ 1000000, |
+ PP_HARDWAREACCELERATION_WITHFALLBACK, |
+ callback.GetCallback())); |
+ |
+ ASSERT_EQ(PP_OK, callback.result()); |
+ |
+ pp::Size coded_size; |
+ ASSERT_EQ(PP_OK, video_encoder.GetFrameCodedSize(&coded_size)); |
+ ASSERT_GE(coded_size.GetArea(), video_size.GetArea()); |
+ ASSERT_GE(video_encoder.GetFramesRequired(), 1); |
} |
- // TODO(llandwerlin): add more tests once software video encode is |
- // available. |
PASS(); |
} |