OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/tests/test_video_decoder.h" | 5 #include "ppapi/tests/test_video_decoder.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_video_decoder_dev.h" | 7 #include "ppapi/c/dev/ppb_video_decoder_dev.h" |
8 #include "ppapi/c/dev/ppb_testing_dev.h" | 8 #include "ppapi/c/dev/ppb_testing_dev.h" |
9 #include "ppapi/c/pp_errors.h" | |
9 #include "ppapi/c/ppb_var.h" | 10 #include "ppapi/c/ppb_var.h" |
10 #include "ppapi/tests/testing_instance.h" | 11 #include "ppapi/tests/testing_instance.h" |
11 | 12 |
12 REGISTER_TEST_CASE(VideoDecoder); | 13 REGISTER_TEST_CASE(VideoDecoder); |
13 | 14 |
14 bool TestVideoDecoder::Init() { | 15 bool TestVideoDecoder::Init() { |
15 video_decoder_interface_ = reinterpret_cast<PPB_VideoDecoder_Dev const*>( | 16 video_decoder_interface_ = reinterpret_cast<PPB_VideoDecoder_Dev const*>( |
16 pp::Module::Get()->GetBrowserInterface(PPB_VIDEODECODER_DEV_INTERFACE)); | 17 pp::Module::Get()->GetBrowserInterface(PPB_VIDEODECODER_DEV_INTERFACE)); |
17 var_interface_ = reinterpret_cast<PPB_Var const*>( | 18 var_interface_ = reinterpret_cast<PPB_Var const*>( |
18 pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE)); | 19 pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE)); |
19 return video_decoder_interface_ && var_interface_ && InitTestingInterface(); | 20 return video_decoder_interface_ && var_interface_ && InitTestingInterface(); |
20 } | 21 } |
21 | 22 |
22 void TestVideoDecoder::RunTest() { | 23 void TestVideoDecoder::RunTest() { |
23 instance_->LogTest("Create", TestCreate()); | 24 RUN_TEST(CreateInit); |
24 } | 25 } |
25 | 26 |
26 void TestVideoDecoder::QuitMessageLoop() { | 27 void TestVideoDecoder::QuitMessageLoop() { |
27 testing_interface_->QuitMessageLoop(instance_->pp_instance()); | 28 testing_interface_->QuitMessageLoop(instance_->pp_instance()); |
28 } | 29 } |
29 | 30 |
30 std::string TestVideoDecoder::TestCreate() { | 31 std::string TestVideoDecoder::TestCreateInit() { |
darin (slow to review)
2011/06/03 17:54:58
nit: TestCreateAndInitialize
polina
2011/06/03 19:35:04
Done.
| |
31 PP_Resource decoder = video_decoder_interface_->Create( | 32 PP_Resource decoder = video_decoder_interface_->Create( |
32 instance_->pp_instance(), NULL, PP_MakeCompletionCallback(NULL, NULL)); | 33 instance_->pp_instance()); |
33 if (decoder == 0) { | 34 if (decoder == 0) |
34 return "Error creating the decoder"; | 35 return "Create: error creating the decoder"; |
35 } | 36 |
37 int32_t pp_error = video_decoder_interface_->Init( | |
38 decoder, NULL, PP_BlockUntilComplete()); | |
39 pp::Module::Get()->core()->ReleaseResource(decoder); | |
40 if (pp_error != PP_ERROR_BADARGUMENT) | |
41 return "Init: error detecting null callback"; | |
42 | |
36 PASS(); | 43 PASS(); |
37 } | 44 } |
OLD | NEW |