OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // TODO(dmichael): Remove this constructor. | 86 // TODO(dmichael): Remove this constructor. |
87 TestCompletionCallback(PP_Instance instance, bool force_async); | 87 TestCompletionCallback(PP_Instance instance, bool force_async); |
88 | 88 |
89 TestCompletionCallback(PP_Instance instance, CallbackType callback_type); | 89 TestCompletionCallback(PP_Instance instance, CallbackType callback_type); |
90 | 90 |
91 // Sets a Delegate instance. OnCallback() of this instance will be invoked | 91 // Sets a Delegate instance. OnCallback() of this instance will be invoked |
92 // when the completion callback is invoked. | 92 // when the completion callback is invoked. |
93 // The delegate will be reset when Reset() or GetCallback() is called. | 93 // The delegate will be reset when Reset() or GetCallback() is called. |
94 void SetDelegate(Delegate* delegate) { delegate_ = delegate; } | 94 void SetDelegate(Delegate* delegate) { delegate_ = delegate; } |
95 | 95 |
96 // Waits for the callback to be called and returns the | |
97 // result. Returns immediately if the callback was previously called | |
98 // and the result wasn't returned (i.e. each result value received | |
99 // by the callback is returned by WaitForResult() once and only | |
100 // once). DEPRECATED: Please use the one below. | |
101 // TODO(dmichael): Remove this one when all the tests are updated. | |
102 int32_t WaitForResult(); | |
103 | |
104 // Wait for a result, given the return from the call which took this callback | 96 // Wait for a result, given the return from the call which took this callback |
105 // as a parameter. If |result| is PP_OK_COMPLETIONPENDING, WaitForResult will | 97 // as a parameter. If |result| is PP_OK_COMPLETIONPENDING, WaitForResult will |
106 // block until its callback has been invoked (in some cases, this will already | 98 // block until its callback has been invoked (in some cases, this will already |
107 // have happened, and WaitForCallback can return immediately). | 99 // have happened, and WaitForCallback can return immediately). |
108 // For any other values, WaitForResult will simply set its internal "result_" | 100 // For any other values, WaitForResult will simply set its internal "result_" |
109 // field. To retrieve the final result of the operation (i.e., the result | 101 // field. To retrieve the final result of the operation (i.e., the result |
110 // the callback has run, if necessary), call result(). You can call result() | 102 // the callback has run, if necessary), call result(). You can call result() |
111 // as many times as necessary until a new pp::CompletionCallback is retrieved. | 103 // as many times as necessary until a new pp::CompletionCallback is retrieved. |
112 // | 104 // |
113 // In some cases, you may want to check that the callback was invoked in the | 105 // In some cases, you may want to check that the callback was invoked in the |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 #error Please add support for your platform in ppapi/tests/test_utils.h | 264 #error Please add support for your platform in ppapi/tests/test_utils.h |
273 #endif | 265 #endif |
274 | 266 |
275 /* These are used to determine POSIX-like implementations vs Windows. */ | 267 /* These are used to determine POSIX-like implementations vs Windows. */ |
276 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ | 268 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ |
277 defined(__OpenBSD__) || defined(__sun) || defined(__native_client__) | 269 defined(__OpenBSD__) || defined(__sun) || defined(__native_client__) |
278 #define PPAPI_POSIX 1 | 270 #define PPAPI_POSIX 1 |
279 #endif | 271 #endif |
280 | 272 |
281 #endif // PPAPI_TESTS_TEST_UTILS_H_ | 273 #endif // PPAPI_TESTS_TEST_UTILS_H_ |
OLD | NEW |