| 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 <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
| 6 | 6 |
| 7 #include "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/ppb_video_decoder.h" | 10 #include "ppapi/c/ppb_video_decoder.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 bool called_; | 54 bool called_; |
| 55 int32_t result_; | 55 int32_t result_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 class VideoDecoderResourceTest : public PluginProxyTest { | 58 class VideoDecoderResourceTest : public PluginProxyTest { |
| 59 public: | 59 public: |
| 60 VideoDecoderResourceTest() | 60 VideoDecoderResourceTest() |
| 61 : decoder_iface_(thunk::GetPPB_VideoDecoder_0_2_Thunk()) {} | 61 : decoder_iface_(thunk::GetPPB_VideoDecoder_1_0_Thunk()) {} |
| 62 | 62 |
| 63 const PPB_VideoDecoder_0_2* decoder_iface() const { return decoder_iface_; } | 63 const PPB_VideoDecoder_1_0* decoder_iface() const { return decoder_iface_; } |
| 64 | 64 |
| 65 void SendReply(const ResourceMessageCallParams& params, | 65 void SendReply(const ResourceMessageCallParams& params, |
| 66 int32_t result, | 66 int32_t result, |
| 67 const IPC::Message& nested_message) { | 67 const IPC::Message& nested_message) { |
| 68 ResourceMessageReplyParams reply_params(params.pp_resource(), | 68 ResourceMessageReplyParams reply_params(params.pp_resource(), |
| 69 params.sequence()); | 69 params.sequence()); |
| 70 reply_params.set_result(result); | 70 reply_params.set_result(result); |
| 71 PluginMessageFilter::DispatchResourceReplyForTest(reply_params, | 71 PluginMessageFilter::DispatchResourceReplyForTest(reply_params, |
| 72 nested_message); | 72 nested_message); |
| 73 } | 73 } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 210 } |
| 211 | 211 |
| 212 void SendDecodeReply(const ResourceMessageCallParams& params, | 212 void SendDecodeReply(const ResourceMessageCallParams& params, |
| 213 uint32_t shm_id) { | 213 uint32_t shm_id) { |
| 214 SendReply(params, PP_OK, PpapiPluginMsg_VideoDecoder_DecodeReply(shm_id)); | 214 SendReply(params, PP_OK, PpapiPluginMsg_VideoDecoder_DecodeReply(shm_id)); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void SendPictureReady(const ResourceMessageCallParams& params, | 217 void SendPictureReady(const ResourceMessageCallParams& params, |
| 218 uint32_t decode_count, | 218 uint32_t decode_count, |
| 219 uint32_t texture_id) { | 219 uint32_t texture_id) { |
| 220 SendReply( | 220 PP_Rect visible_rect = PP_MakeRectFromXYWH(0, 0, 640, 480); |
| 221 params, | 221 SendReply(params, PP_OK, PpapiPluginMsg_VideoDecoder_PictureReady( |
| 222 PP_OK, | 222 decode_count, texture_id, visible_rect)); |
| 223 PpapiPluginMsg_VideoDecoder_PictureReady(decode_count, texture_id)); | |
| 224 } | 223 } |
| 225 | 224 |
| 226 void SendFlushReply(const ResourceMessageCallParams& params) { | 225 void SendFlushReply(const ResourceMessageCallParams& params) { |
| 227 SendReply(params, PP_OK, PpapiPluginMsg_VideoDecoder_FlushReply()); | 226 SendReply(params, PP_OK, PpapiPluginMsg_VideoDecoder_FlushReply()); |
| 228 } | 227 } |
| 229 | 228 |
| 230 void SendResetReply(const ResourceMessageCallParams& params) { | 229 void SendResetReply(const ResourceMessageCallParams& params) { |
| 231 SendReply(params, PP_OK, PpapiPluginMsg_VideoDecoder_ResetReply()); | 230 SendReply(params, PP_OK, PpapiPluginMsg_VideoDecoder_ResetReply()); |
| 232 } | 231 } |
| 233 | 232 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 290 |
| 292 private: | 291 private: |
| 293 bool CheckMsg(ResourceMessageCallParams* params, int id) { | 292 bool CheckMsg(ResourceMessageCallParams* params, int id) { |
| 294 IPC::Message msg; | 293 IPC::Message msg; |
| 295 if (!sink().GetFirstResourceCallMatching(id, params, &msg)) | 294 if (!sink().GetFirstResourceCallMatching(id, params, &msg)) |
| 296 return false; | 295 return false; |
| 297 sink().ClearMessages(); | 296 sink().ClearMessages(); |
| 298 return true; | 297 return true; |
| 299 } | 298 } |
| 300 | 299 |
| 301 const PPB_VideoDecoder_0_2* decoder_iface_; | 300 const PPB_VideoDecoder_1_0* decoder_iface_; |
| 302 | 301 |
| 303 char decode_buffer_[kDecodeBufferSize]; | 302 char decode_buffer_[kDecodeBufferSize]; |
| 304 }; | 303 }; |
| 305 | 304 |
| 306 } // namespace | 305 } // namespace |
| 307 | 306 |
| 308 TEST_F(VideoDecoderResourceTest, Initialize) { | 307 TEST_F(VideoDecoderResourceTest, Initialize) { |
| 309 // Initialize with 0 graphics3d_context should fail. | 308 // Initialize with 0 graphics3d_context should fail. |
| 310 { | 309 { |
| 311 LockingResourceReleaser decoder(CreateDecoder()); | 310 LockingResourceReleaser decoder(CreateDecoder()); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 ASSERT_FALSE(uncalled_cb.called()); | 572 ASSERT_FALSE(uncalled_cb.called()); |
| 574 ASSERT_EQ(PP_ERROR_RESOURCE_FAILED, CallFlush(decoder.get(), &uncalled_cb)); | 573 ASSERT_EQ(PP_ERROR_RESOURCE_FAILED, CallFlush(decoder.get(), &uncalled_cb)); |
| 575 ASSERT_FALSE(uncalled_cb.called()); | 574 ASSERT_FALSE(uncalled_cb.called()); |
| 576 ASSERT_EQ(PP_ERROR_RESOURCE_FAILED, CallReset(decoder.get(), &uncalled_cb)); | 575 ASSERT_EQ(PP_ERROR_RESOURCE_FAILED, CallReset(decoder.get(), &uncalled_cb)); |
| 577 ASSERT_FALSE(uncalled_cb.called()); | 576 ASSERT_FALSE(uncalled_cb.called()); |
| 578 } | 577 } |
| 579 #endif // !defined(OS_WIN) || !defined(ARCH_CPU_64_BITS) | 578 #endif // !defined(OS_WIN) || !defined(ARCH_CPU_64_BITS) |
| 580 | 579 |
| 581 } // namespace proxy | 580 } // namespace proxy |
| 582 } // namespace ppapi | 581 } // namespace ppapi |
| OLD | NEW |