From b47815f17b42a73d3da78364bd10b501450db00b Mon Sep 17 00:00:00 2001 From: "polina@google.com" Date: Sat, 4 Jun 2011 01:33:11 +0000 Subject: PPAPI: Fix interface functions that take PP_CompletionCallbacks, but don't return codes from pp_errors.h BUG=none TEST=compile + manually run ppapi_tests::VideoDecoder Review URL: http://codereview.chromium.org/6975053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87905 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/tests/arch_dependent_sizes_32.h | 2 +- ppapi/tests/arch_dependent_sizes_64.h | 2 +- ppapi/tests/test_video_decoder.cc | 19 +++++++++++++------ ppapi/tests/test_video_decoder.h | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) (limited to 'ppapi/tests') diff --git a/ppapi/tests/arch_dependent_sizes_32.h b/ppapi/tests/arch_dependent_sizes_32.h index b7661cb..f797494 100644 --- a/ppapi/tests/arch_dependent_sizes_32.h +++ b/ppapi/tests/arch_dependent_sizes_32.h @@ -19,7 +19,7 @@ PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 8); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FileChooserOptions_Dev, 8); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Picture_Dev, 24); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoBitstreamBuffer_Dev, 12); -PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 36); +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 40); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 20); #endif /* PPAPI_TESTS_ARCH_DEPENDENT_SIZES_32_H_ */ diff --git a/ppapi/tests/arch_dependent_sizes_64.h b/ppapi/tests/arch_dependent_sizes_64.h index de68721..378c5b3 100644 --- a/ppapi/tests/arch_dependent_sizes_64.h +++ b/ppapi/tests/arch_dependent_sizes_64.h @@ -19,7 +19,7 @@ PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 16); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FileChooserOptions_Dev, 16); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Picture_Dev, 24); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoBitstreamBuffer_Dev, 12); -PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 72); +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 80); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 40); #endif /* PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_ */ diff --git a/ppapi/tests/test_video_decoder.cc b/ppapi/tests/test_video_decoder.cc index db0da55..82f99c7 100644 --- a/ppapi/tests/test_video_decoder.cc +++ b/ppapi/tests/test_video_decoder.cc @@ -6,6 +6,7 @@ #include "ppapi/c/dev/ppb_video_decoder_dev.h" #include "ppapi/c/dev/ppb_testing_dev.h" +#include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_var.h" #include "ppapi/tests/testing_instance.h" @@ -20,18 +21,24 @@ bool TestVideoDecoder::Init() { } void TestVideoDecoder::RunTest() { - instance_->LogTest("Create", TestCreate()); + RUN_TEST(CreateAndInitialize); } void TestVideoDecoder::QuitMessageLoop() { testing_interface_->QuitMessageLoop(instance_->pp_instance()); } -std::string TestVideoDecoder::TestCreate() { +std::string TestVideoDecoder::TestCreateAndInitialize() { PP_Resource decoder = video_decoder_interface_->Create( - instance_->pp_instance(), NULL, PP_MakeCompletionCallback(NULL, NULL)); - if (decoder == 0) { - return "Error creating the decoder"; - } + instance_->pp_instance()); + if (decoder == 0) + return "Create: error creating the decoder"; + + int32_t pp_error = video_decoder_interface_->Initialize( + decoder, NULL, PP_BlockUntilComplete()); + pp::Module::Get()->core()->ReleaseResource(decoder); + if (pp_error != PP_ERROR_BADARGUMENT) + return "Initialize: error detecting null callback"; + PASS(); } diff --git a/ppapi/tests/test_video_decoder.h b/ppapi/tests/test_video_decoder.h index 15e0b39..dbef66f 100644 --- a/ppapi/tests/test_video_decoder.h +++ b/ppapi/tests/test_video_decoder.h @@ -22,7 +22,7 @@ class TestVideoDecoder : public TestCase { void QuitMessageLoop(); private: - std::string TestCreate(); + std::string TestCreateAndInitialize(); // Used by the tests that access the C API directly. const PPB_VideoDecoder_Dev* video_decoder_interface_; -- cgit v1.1