OLD | NEW |
1 // Copyright (c) 2010 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 #ifndef PPAPI_TESTS_TEST_UTILS_H_ | 5 #ifndef PPAPI_TESTS_TEST_UTILS_H_ |
6 #define PPAPI_TESTS_TEST_UTILS_H_ | 6 #define PPAPI_TESTS_TEST_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/c/dev/ppb_testing_dev.h" | 10 #include "ppapi/c/dev/ppb_testing_dev.h" |
11 #include "ppapi/c/pp_instance.h" | 11 #include "ppapi/c/pp_instance.h" |
12 #include "ppapi/c/pp_stdint.h" | 12 #include "ppapi/c/pp_stdint.h" |
13 #include "ppapi/cpp/completion_callback.h" | 13 #include "ppapi/cpp/completion_callback.h" |
14 | 14 |
15 const PPB_Testing_Dev* GetTestingInterface(); | 15 const PPB_Testing_Dev* GetTestingInterface(); |
16 std::string ReportError(const char* method, int32_t error); | 16 std::string ReportError(const char* method, int32_t error); |
17 | 17 |
18 class TestCompletionCallback { | 18 class TestCompletionCallback { |
19 public: | 19 public: |
20 TestCompletionCallback(PP_Instance instance); | 20 TestCompletionCallback(PP_Instance instance); |
| 21 TestCompletionCallback(PP_Instance instance, bool force_async); |
21 | 22 |
22 int32_t WaitForResult(); | 23 int32_t WaitForResult(); |
23 | 24 |
24 operator pp::CompletionCallback() const; | 25 operator pp::CompletionCallback() const; |
25 | 26 |
26 unsigned run_count() const { return run_count_; } | 27 unsigned run_count() const { return run_count_; } |
27 void reset_run_count() { run_count_ = 0; } | 28 void reset_run_count() { run_count_ = 0; } |
28 | 29 |
29 int32_t result() const { return result_; } | 30 int32_t result() const { return result_; } |
30 | 31 |
31 private: | 32 private: |
32 static void Handler(void* user_data, int32_t result); | 33 static void Handler(void* user_data, int32_t result); |
33 | 34 |
34 int32_t result_; | 35 int32_t result_; |
| 36 bool force_async_; |
35 bool post_quit_task_; | 37 bool post_quit_task_; |
36 unsigned run_count_; | 38 unsigned run_count_; |
37 PP_Instance instance_; | 39 PP_Instance instance_; |
38 }; | 40 }; |
39 | 41 |
40 #endif // PPAPI_TESTS_TEST_UTILS_H_ | 42 #endif // PPAPI_TESTS_TEST_UTILS_H_ |
OLD | NEW |