| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef MEDIA_CDM_PPAPI_CDM_FILE_IO_TEST_H_ | 5 #ifndef MEDIA_CDM_PPAPI_CDM_FILE_IO_TEST_H_ |
| 6 #define MEDIA_CDM_PPAPI_CDM_FILE_IO_TEST_H_ | 6 #define MEDIA_CDM_PPAPI_CDM_FILE_IO_TEST_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <stack> | 9 #include <stack> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 ACTION_READ, | 55 ACTION_READ, |
| 56 RESULT_READ, | 56 RESULT_READ, |
| 57 ACTION_WRITE, | 57 ACTION_WRITE, |
| 58 RESULT_WRITE, | 58 RESULT_WRITE, |
| 59 ACTION_CLOSE // If ACTION_CLOSE is not specified, FileIO::Close() will be | 59 ACTION_CLOSE // If ACTION_CLOSE is not specified, FileIO::Close() will be |
| 60 // automatically called at the end of the test. | 60 // automatically called at the end of the test. |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 FileIOTest(const CreateFileIOCB& create_file_io_cb, | 63 FileIOTest(const CreateFileIOCB& create_file_io_cb, |
| 64 const std::string& test_name); | 64 const std::string& test_name); |
| 65 ~FileIOTest(); | 65 ~FileIOTest() override; |
| 66 | 66 |
| 67 // Adds a test step in this test. |this| object doesn't take the ownership of | 67 // Adds a test step in this test. |this| object doesn't take the ownership of |
| 68 // |data|, which should be valid throughout the lifetime of |this| object. | 68 // |data|, which should be valid throughout the lifetime of |this| object. |
| 69 void AddTestStep( | 69 void AddTestStep( |
| 70 StepType type, Status status, const uint8* data, uint32 data_size); | 70 StepType type, Status status, const uint8* data, uint32 data_size); |
| 71 | 71 |
| 72 // Runs this test case and returns the test result through |completion_cb|. | 72 // Runs this test case and returns the test result through |completion_cb|. |
| 73 void Run(const CompletionCB& completion_cb); | 73 void Run(const CompletionCB& completion_cb); |
| 74 | 74 |
| 75 private: | 75 private: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 89 uint32 data_size; | 89 uint32 data_size; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 // Returns whether |test_step| is a RESULT_* step. | 92 // Returns whether |test_step| is a RESULT_* step. |
| 93 static bool IsResult(const TestStep& test_step); | 93 static bool IsResult(const TestStep& test_step); |
| 94 | 94 |
| 95 // Returns whether two results match. | 95 // Returns whether two results match. |
| 96 static bool MatchesResult(const TestStep& a, const TestStep& b); | 96 static bool MatchesResult(const TestStep& a, const TestStep& b); |
| 97 | 97 |
| 98 // cdm::FileIOClient implementation. | 98 // cdm::FileIOClient implementation. |
| 99 virtual void OnOpenComplete(Status status) override; | 99 void OnOpenComplete(Status status) override; |
| 100 virtual void OnReadComplete(Status status, | 100 void OnReadComplete(Status status, |
| 101 const uint8_t* data, | 101 const uint8_t* data, |
| 102 uint32_t data_size) override; | 102 uint32_t data_size) override; |
| 103 virtual void OnWriteComplete(Status status) override; | 103 void OnWriteComplete(Status status) override; |
| 104 | 104 |
| 105 // Runs the next step in this test case. | 105 // Runs the next step in this test case. |
| 106 void RunNextStep(); | 106 void RunNextStep(); |
| 107 | 107 |
| 108 void OnResult(const TestStep& result); | 108 void OnResult(const TestStep& result); |
| 109 | 109 |
| 110 // Checks whether the test result matches this step. This can only be called | 110 // Checks whether the test result matches this step. This can only be called |
| 111 // when this step is a RESULT_* step. | 111 // when this step is a RESULT_* step. |
| 112 bool CheckResult(const TestStep& result); | 112 bool CheckResult(const TestStep& result); |
| 113 | 113 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 std::vector<uint8> large_data_; | 148 std::vector<uint8> large_data_; |
| 149 size_t total_num_tests_; // Total number of tests. | 149 size_t total_num_tests_; // Total number of tests. |
| 150 size_t num_passed_tests_; // Number of passed tests. | 150 size_t num_passed_tests_; // Number of passed tests. |
| 151 | 151 |
| 152 DISALLOW_COPY_AND_ASSIGN (FileIOTestRunner); | 152 DISALLOW_COPY_AND_ASSIGN (FileIOTestRunner); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace media | 155 } // namespace media |
| 156 | 156 |
| 157 #endif // MEDIA_CDM_PPAPI_CDM_FILE_IO_TEST_H_ | 157 #endif // MEDIA_CDM_PPAPI_CDM_FILE_IO_TEST_H_ |
| OLD | NEW |