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 // This file contains implementation the Pepper Video Decoder API tester. Tester |
| 6 // is simple realization of Chromium's TestCase class that implements a test |
| 7 // case for Pepper plugin interface. |
| 8 |
5 #ifndef PPAPI_TESTS_TEST_VIDEO_DECODER_H_ | 9 #ifndef PPAPI_TESTS_TEST_VIDEO_DECODER_H_ |
6 #define PPAPI_TESTS_TEST_VIDEO_DECODER_H_ | 10 #define PPAPI_TESTS_TEST_VIDEO_DECODER_H_ |
7 | 11 |
| 12 #include <string> |
| 13 |
8 #include "ppapi/c/pp_stdint.h" | 14 #include "ppapi/c/pp_stdint.h" |
| 15 #include "ppapi/cpp/completion_callback.h" |
| 16 #include "ppapi/cpp/dev/graphics_3d_client_dev.h" |
| 17 #include "ppapi/cpp/dev/video_decoder_dev.h" |
| 18 #include "ppapi/examples/video_decoder/video_decoder_session.h" |
9 #include "ppapi/tests/test_case.h" | 19 #include "ppapi/tests/test_case.h" |
| 20 #include "ppapi/tests/test_utils.h" |
| 21 #include "ppapi/tests/testing_instance.h" |
10 | 22 |
11 struct PPB_Var; | 23 class TestVideoSource; |
12 struct PPB_VideoDecoder_Dev; | |
13 | 24 |
14 class TestVideoDecoder : public TestCase { | 25 // Main class for video decoder Pepper plugin tester. |
| 26 class TestVideoDecoder : public TestCase, |
| 27 public VideoDecoderSessionClient { |
15 public: | 28 public: |
16 TestVideoDecoder(TestingInstance* instance) : TestCase(instance) {} | 29 explicit TestVideoDecoder(TestingInstance* instance) |
| 30 : TestCase(instance), |
| 31 cb_factory_(this) {} |
17 | 32 |
18 // TestCase implementation. | 33 // TestCase implementation. |
19 virtual bool Init(); | 34 virtual bool Init(); |
20 virtual void RunTest(); | 35 virtual void RunTest(); |
21 | 36 |
22 void QuitMessageLoop(); | 37 void QuitMessageLoop(); |
23 | 38 |
24 private: | 39 private: |
25 std::string TestCreate(); | 40 std::string TestH264(); |
| 41 // Variables to hold the test status. |
| 42 int32_t test_result_; |
| 43 bool test_completed_; |
| 44 // Video decoder session that actually runs the decoder. |
| 45 VideoDecoderSession* video_decoder_session_; |
| 46 // Source for the video bitstream. |
| 47 VideoBitstreamInterface* video_bitstream_source_; |
| 48 // Target for the decoded pictures. |
| 49 DisplayInterface* display_interface_; |
| 50 // Callback factory for generating completion callbacks. |
| 51 pp::CompletionCallbackFactory<TestVideoDecoder> cb_factory_; |
| 52 // Wait for the completion of test. |
| 53 int32_t WaitForCompletion(); |
26 | 54 |
27 // Used by the tests that access the C API directly. | 55 // VideoDecoderSessionClient implementation. |
28 const PPB_VideoDecoder_Dev* video_decoder_interface_; | 56 virtual void OnSessionCompleted(int32_t result); |
29 const PPB_Var* var_interface_; | 57 |
| 58 // Callbacks for functions controlling the session. |
| 59 void OnInitializeCompleted(int32_t result); |
| 60 void OnRunCompleted(int32_t result); |
| 61 void OnStopCompleted(int32_t result); |
| 62 void OnFlushCompleted(int32_t result); |
| 63 void OnTeardownCompleted(int32_t result); |
30 }; | 64 }; |
31 | 65 |
32 #endif // PPAPI_TESTS_TEST_VIDEO_DECODER_H_ | 66 #endif // PPAPI_TESTS_TEST_VIDEO_DECODER_H_ |
OLD | NEW |