| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/cpp/video_decoder.h" | 8 #include "ppapi/cpp/video_decoder.h" |
| 9 #include "ppapi/lib/gl/gles2/gl2ext_ppapi.h" | 9 #include "ppapi/lib/gl/gles2/gl2ext_ppapi.h" |
| 10 #include "ppapi/tests/testing_instance.h" | 10 #include "ppapi/tests/testing_instance.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 std::string TestVideoDecoder::TestCreate() { | 32 std::string TestVideoDecoder::TestCreate() { |
| 33 // Test that Initialize fails with a bad Graphics3D resource. | 33 // Test that Initialize fails with a bad Graphics3D resource. |
| 34 { | 34 { |
| 35 pp::VideoDecoder video_decoder(instance_); | 35 pp::VideoDecoder video_decoder(instance_); |
| 36 ASSERT_FALSE(video_decoder.is_null()); | 36 ASSERT_FALSE(video_decoder.is_null()); |
| 37 | 37 |
| 38 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); | 38 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); |
| 39 pp::Graphics3D null_graphics_3d; | 39 pp::Graphics3D null_graphics_3d; |
| 40 callback.WaitForResult(video_decoder.Initialize(null_graphics_3d, | 40 callback.WaitForResult(video_decoder.Initialize(null_graphics_3d, |
| 41 PP_VIDEOPROFILE_VP8MAIN, | 41 PP_VIDEOPROFILE_VP8_ANY, |
| 42 kAllowSoftwareFallback, | 42 kAllowSoftwareFallback, |
| 43 callback.GetCallback())); | 43 callback.GetCallback())); |
| 44 ASSERT_EQ(PP_ERROR_BADRESOURCE, callback.result()); | 44 ASSERT_EQ(PP_ERROR_BADRESOURCE, callback.result()); |
| 45 } | 45 } |
| 46 // Test that Initialize fails with a bad profile enum value. | 46 // Test that Initialize fails with a bad profile enum value. |
| 47 { | 47 { |
| 48 pp::VideoDecoder video_decoder(instance_); | 48 pp::VideoDecoder video_decoder(instance_); |
| 49 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); | 49 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); |
| 50 const PP_VideoProfile kInvalidProfile = static_cast<PP_VideoProfile>(-1); | 50 const PP_VideoProfile kInvalidProfile = static_cast<PP_VideoProfile>(-1); |
| 51 callback.WaitForResult(video_decoder.Initialize(graphics_3d_, | 51 callback.WaitForResult(video_decoder.Initialize(graphics_3d_, |
| 52 kInvalidProfile, | 52 kInvalidProfile, |
| 53 kAllowSoftwareFallback, | 53 kAllowSoftwareFallback, |
| 54 callback.GetCallback())); | 54 callback.GetCallback())); |
| 55 ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result()); | 55 ASSERT_EQ(PP_ERROR_BADARGUMENT, callback.result()); |
| 56 } | 56 } |
| 57 // Test that Initialize succeeds if we can create a Graphics3D resources and | 57 // Test that Initialize succeeds if we can create a Graphics3D resources and |
| 58 // if we allow software fallback to VP8, which should always be supported. | 58 // if we allow software fallback to VP8, which should always be supported. |
| 59 if (!graphics_3d_.is_null()) { | 59 if (!graphics_3d_.is_null()) { |
| 60 pp::VideoDecoder video_decoder(instance_); | 60 pp::VideoDecoder video_decoder(instance_); |
| 61 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); | 61 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); |
| 62 callback.WaitForResult(video_decoder.Initialize(graphics_3d_, | 62 callback.WaitForResult(video_decoder.Initialize(graphics_3d_, |
| 63 PP_VIDEOPROFILE_VP8MAIN, | 63 PP_VIDEOPROFILE_VP8_ANY, |
| 64 kAllowSoftwareFallback, | 64 kAllowSoftwareFallback, |
| 65 callback.GetCallback())); | 65 callback.GetCallback())); |
| 66 ASSERT_EQ(PP_OK, callback.result()); | 66 ASSERT_EQ(PP_OK, callback.result()); |
| 67 } | 67 } |
| 68 | 68 |
| 69 PASS(); | 69 PASS(); |
| 70 } | 70 } |
| OLD | NEW |