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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 class NestedEvent { | 43 class NestedEvent { |
44 public: | 44 public: |
45 explicit NestedEvent(PP_Instance instance) | 45 explicit NestedEvent(PP_Instance instance) |
46 : instance_(instance), waiting_(false), signalled_(false) { | 46 : instance_(instance), waiting_(false), signalled_(false) { |
47 } | 47 } |
48 // Run a nested message loop and wait until Signal() is called. If Signal() | 48 // Run a nested message loop and wait until Signal() is called. If Signal() |
49 // has already been called, return immediately without running a nested loop. | 49 // has already been called, return immediately without running a nested loop. |
50 void Wait(); | 50 void Wait(); |
51 // Signal the NestedEvent. If Wait() has been called, quit the message loop. | 51 // Signal the NestedEvent. If Wait() has been called, quit the message loop. |
52 void Signal(); | 52 void Signal(); |
| 53 // Reset the NestedEvent so it can be used again. |
| 54 void Reset(); |
53 private: | 55 private: |
54 PP_Instance instance_; | 56 PP_Instance instance_; |
55 bool waiting_; | 57 bool waiting_; |
56 bool signalled_; | 58 bool signalled_; |
57 // Disable copy and assign. | 59 // Disable copy and assign. |
58 NestedEvent(const NestedEvent&); | 60 NestedEvent(const NestedEvent&); |
59 NestedEvent& operator=(const NestedEvent&); | 61 NestedEvent& operator=(const NestedEvent&); |
60 }; | 62 }; |
61 | 63 |
62 enum CallbackType { PP_REQUIRED, PP_OPTIONAL, PP_BLOCKING }; | 64 enum CallbackType { PP_REQUIRED, PP_OPTIONAL, PP_BLOCKING }; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 #error Please add support for your platform in ppapi/tests/test_utils.h | 201 #error Please add support for your platform in ppapi/tests/test_utils.h |
200 #endif | 202 #endif |
201 | 203 |
202 /* These are used to determine POSIX-like implementations vs Windows. */ | 204 /* These are used to determine POSIX-like implementations vs Windows. */ |
203 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ | 205 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ |
204 defined(__OpenBSD__) || defined(__sun) || defined(__native_client__) | 206 defined(__OpenBSD__) || defined(__sun) || defined(__native_client__) |
205 #define PPAPI_POSIX 1 | 207 #define PPAPI_POSIX 1 |
206 #endif | 208 #endif |
207 | 209 |
208 #endif // PPAPI_TESTS_TEST_UTILS_H_ | 210 #endif // PPAPI_TESTS_TEST_UTILS_H_ |
OLD | NEW |