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" |
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 #include "ppapi/cpp/message_loop.h" | 14 #include "ppapi/cpp/message_loop.h" |
15 #include "ppapi/utility/completion_callback_factory.h" | 15 #include "ppapi/utility/completion_callback_factory.h" |
16 | 16 |
17 // Timeout to wait for some action to complete. | 17 // Timeout to wait for some action to complete. |
18 extern const int kActionTimeoutMs; | 18 extern const int kActionTimeoutMs; |
19 | 19 |
20 const PPB_Testing_Dev* GetTestingInterface(); | 20 const PPB_Testing_Dev* GetTestingInterface(); |
21 std::string ReportError(const char* method, int32_t error); | 21 std::string ReportError(const char* method, int32_t error); |
22 void PlatformSleep(int duration_ms); | 22 void PlatformSleep(int duration_ms); |
23 bool GetLocalHostPort(PP_Instance instance, std::string* host, uint16_t* port); | 23 bool GetLocalHostPort(PP_Instance instance, std::string* host, uint16_t* port); |
24 | 24 |
| 25 uint16_t ConvertFromNetEndian16(uint16_t x); |
| 26 uint16_t ConvertToNetEndian16(uint16_t x); |
| 27 |
25 // NestedEvent allows you to run a nested MessageLoop and wait for a particular | 28 // NestedEvent allows you to run a nested MessageLoop and wait for a particular |
26 // event to complete. For example, you can use it to wait for a callback on a | 29 // event to complete. For example, you can use it to wait for a callback on a |
27 // PPP interface, which will "Signal" the event and make the loop quit. | 30 // PPP interface, which will "Signal" the event and make the loop quit. |
28 // "Wait()" will return immediately if it has already been signalled. Otherwise, | 31 // "Wait()" will return immediately if it has already been signalled. Otherwise, |
29 // it will run a nested message loop (using PPB_Testing.RunMessageLoop) and will | 32 // it will run a nested message loop (using PPB_Testing.RunMessageLoop) and will |
30 // return only after it has been signalled. | 33 // return only after it has been signalled. |
31 // Example: | 34 // Example: |
32 // std::string TestFullscreen::TestNormalToFullscreen() { | 35 // std::string TestFullscreen::TestNormalToFullscreen() { |
33 // pp::Fullscreen screen_mode(instance); | 36 // pp::Fullscreen screen_mode(instance); |
34 // screen_mode.SetFullscreen(true); | 37 // screen_mode.SetFullscreen(true); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 #error Please add support for your platform in ppapi/tests/test_utils.h | 312 #error Please add support for your platform in ppapi/tests/test_utils.h |
310 #endif | 313 #endif |
311 | 314 |
312 /* These are used to determine POSIX-like implementations vs Windows. */ | 315 /* These are used to determine POSIX-like implementations vs Windows. */ |
313 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ | 316 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ |
314 defined(__OpenBSD__) || defined(__sun) || defined(__native_client__) | 317 defined(__OpenBSD__) || defined(__sun) || defined(__native_client__) |
315 #define PPAPI_POSIX 1 | 318 #define PPAPI_POSIX 1 |
316 #endif | 319 #endif |
317 | 320 |
318 #endif // PPAPI_TESTS_TEST_UTILS_H_ | 321 #endif // PPAPI_TESTS_TEST_UTILS_H_ |
OLD | NEW |