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 #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 // Timeout to wait for some action to complete. |
| 16 extern const int kActionTimeoutMs; |
| 17 |
15 const PPB_Testing_Dev* GetTestingInterface(); | 18 const PPB_Testing_Dev* GetTestingInterface(); |
16 std::string ReportError(const char* method, int32_t error); | 19 std::string ReportError(const char* method, int32_t error); |
| 20 void PlatformSleep(int duration_ms); |
17 | 21 |
18 class TestCompletionCallback { | 22 class TestCompletionCallback { |
19 public: | 23 public: |
20 TestCompletionCallback(PP_Instance instance); | 24 TestCompletionCallback(PP_Instance instance); |
21 TestCompletionCallback(PP_Instance instance, bool force_async); | 25 TestCompletionCallback(PP_Instance instance, bool force_async); |
22 | 26 |
23 // Waits for the callback to be called and returns the | 27 // Waits for the callback to be called and returns the |
24 // result. Returns immediately if the callback was previously called | 28 // result. Returns immediately if the callback was previously called |
25 // and the result wasn't returned (i.e. each result value received | 29 // and the result wasn't returned (i.e. each result value received |
26 // by the callback is returned by WaitForResult() once and only | 30 // by the callback is returned by WaitForResult() once and only |
(...skipping 12 matching lines...) Expand all Loading... |
39 | 43 |
40 bool have_result_; | 44 bool have_result_; |
41 int32_t result_; | 45 int32_t result_; |
42 bool force_async_; | 46 bool force_async_; |
43 bool post_quit_task_; | 47 bool post_quit_task_; |
44 unsigned run_count_; | 48 unsigned run_count_; |
45 PP_Instance instance_; | 49 PP_Instance instance_; |
46 }; | 50 }; |
47 | 51 |
48 #endif // PPAPI_TESTS_TEST_UTILS_H_ | 52 #endif // PPAPI_TESTS_TEST_UTILS_H_ |
OLD | NEW |