[email protected] | de9bdd1 | 2010-11-04 00:36:22 | [diff] [blame] | 1 | // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef PPAPI_TESTS_TEST_UTILS_H_ |
| 6 | #define PPAPI_TESTS_TEST_UTILS_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "ppapi/c/dev/ppb_testing_dev.h" |
| 11 | #include "ppapi/c/pp_stdint.h" |
| 12 | #include "ppapi/cpp/completion_callback.h" |
| 13 | |
| 14 | const PPB_Testing_Dev* GetTestingInterface(); |
| 15 | std::string ReportError(const char* method, int32_t error); |
| 16 | |
| 17 | class TestCompletionCallback { |
| 18 | public: |
| 19 | TestCompletionCallback(); |
| 20 | |
| 21 | int32_t WaitForResult(); |
| 22 | |
| 23 | operator pp::CompletionCallback() const; |
| 24 | |
[email protected] | 64264ef | 2010-12-21 00:45:43 | [diff] [blame^] | 25 | unsigned run_count() const { return run_count_; } |
| 26 | void reset_run_count() { run_count_ = 0; } |
| 27 | |
[email protected] | de9bdd1 | 2010-11-04 00:36:22 | [diff] [blame] | 28 | private: |
| 29 | static void Handler(void* user_data, int32_t result); |
| 30 | |
| 31 | int32_t result_; |
| 32 | bool post_quit_task_; |
[email protected] | 64264ef | 2010-12-21 00:45:43 | [diff] [blame^] | 33 | unsigned run_count_; |
[email protected] | de9bdd1 | 2010-11-04 00:36:22 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | #endif // PPAPI_TESTS_TEST_UTILS_H_ |