| Index: ppapi/tests/test_video_decoder.cc
|
| diff --git a/ppapi/tests/test_video_decoder.cc b/ppapi/tests/test_video_decoder.cc
|
| index f396bda8e3fa2b70570967ece1d0b4285aa630ae..782cde055dcbd82941a0178f4374ffa4f284dae8 100644
|
| --- a/ppapi/tests/test_video_decoder.cc
|
| +++ b/ppapi/tests/test_video_decoder.cc
|
| @@ -9,18 +9,19 @@
|
| #include "ppapi/lib/gl/gles2/gl2ext_ppapi.h"
|
| #include "ppapi/tests/testing_instance.h"
|
|
|
| +const uint32_t kMaxRequestedPictureCount = 100;
|
| +
|
| REGISTER_TEST_CASE(VideoDecoder);
|
|
|
| bool TestVideoDecoder::Init() {
|
| - video_decoder_interface_ = static_cast<const PPB_VideoDecoder_0_1*>(
|
| - pp::Module::Get()->GetBrowserInterface(PPB_VIDEODECODER_INTERFACE_0_1));
|
| const int width = 16;
|
| const int height = 16;
|
| const int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, width,
|
| PP_GRAPHICS3DATTRIB_HEIGHT, height,
|
| PP_GRAPHICS3DATTRIB_NONE};
|
| graphics_3d_ = pp::Graphics3D(instance_, attribs);
|
| - return video_decoder_interface_ && CheckTestingInterface();
|
| + return (pp::Module::Get()->GetBrowserInterface(PPB_VIDEODECODER_INTERFACE) &&
|
| + CheckTestingInterface());
|
| }
|
|
|
| void TestVideoDecoder::RunTests(const std::string& filter) {
|
| @@ -66,6 +67,33 @@ std::string TestVideoDecoder::TestCreate() {
|
| callback.GetCallback()));
|
| ASSERT_EQ(PP_OK, callback.result());
|
| }
|
| + // Test that Initialize succeeds with a larger than normal number of requested
|
| + // picture buffers, if we can create a Graphics3D resources and if we allow
|
| + // software fallback to VP8, which should always be supported.
|
| + if (!graphics_3d_.is_null()) {
|
| + pp::VideoDecoder video_decoder(instance_);
|
| + TestCompletionCallback callback(instance_->pp_instance(), callback_type());
|
| + callback.WaitForResult(
|
| + video_decoder.Initialize(graphics_3d_,
|
| + PP_VIDEOPROFILE_VP8_ANY,
|
| + PP_HARDWAREACCELERATION_WITHFALLBACK,
|
| + kMaxRequestedPictureCount,
|
| + callback.GetCallback()));
|
| + ASSERT_EQ(PP_OK, callback.result());
|
| + }
|
| + // Test that Initialize fails if we request an unreasonable number of picture
|
| + // buffers.
|
| + if (!graphics_3d_.is_null()) {
|
| + pp::VideoDecoder video_decoder(instance_);
|
| + TestCompletionCallback callback(instance_->pp_instance(), callback_type());
|
| + callback.WaitForResult(
|
| + video_decoder.Initialize(graphics_3d_,
|
| + PP_VIDEOPROFILE_VP8_ANY,
|
| + PP_HARDWAREACCELERATION_WITHFALLBACK,
|
| + kMaxRequestedPictureCount + 1,
|
| + callback.GetCallback()));
|
| + ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result());
|
| + }
|
|
|
| PASS();
|
| }
|
|
|