OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 10 matching lines...) Expand all Loading... |
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef UnitTestHelpers_h | 26 #ifndef UnitTestHelpers_h |
27 #define UnitTestHelpers_h | 27 #define UnitTestHelpers_h |
28 | 28 |
29 #include "wtf/PassRefPtr.h" | 29 #include "wtf/PassRefPtr.h" |
30 #include "wtf/text/WTFString.h" | 30 #include "wtf/text/WTFString.h" |
| 31 #include <string> |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
34 class SharedBuffer; | 35 class SharedBuffer; |
35 | 36 |
36 namespace testing { | 37 namespace testing { |
37 | 38 |
| 39 // Note: You may want to use TestingPlatformSupportWithMockScheduler to |
| 40 // provides runUntilIdle() method that can work with WebURLLoaderMockFactory. |
38 void runPendingTasks(); | 41 void runPendingTasks(); |
39 | 42 |
40 // Wait for delayed task to complete or timers to fire for |delayMs| | 43 // Waits for delayed task to complete or timers to fire for |delayMs| |
41 // milliseconds. | 44 // milliseconds. |
42 void runDelayedTasks(double delayMs); | 45 void runDelayedTasks(double delayMs); |
43 | 46 |
44 String blinkRootDir(); | |
45 | |
46 PassRefPtr<SharedBuffer> readFromFile(const String& path); | |
47 | |
48 void enterRunLoop(); | 47 void enterRunLoop(); |
49 void exitRunLoop(); | 48 void exitRunLoop(); |
50 | 49 |
51 void yieldCurrentThread(); | 50 void yieldCurrentThread(); |
52 | 51 |
| 52 // Returns Blink top directory as an absolute path, e.g. |
| 53 // /src/third_party/WebKit. |
| 54 String blinkRootDir(); |
| 55 |
| 56 // Returns test data absolute path for webkit_unit_tests, i.e. |
| 57 // <blinkRootDir>/Source/web/tests/data/<relativePath>. |
| 58 // It returns top web test directory if |relativePath| was not specified. |
| 59 String webTestDataPath(const std::string& relativePath = std::string()); |
| 60 |
| 61 // Returns test data absolute path for blink_platform_unittests, i.e. |
| 62 // <blinkRootDir>/Source/platform/testing/data/<relativePath>. |
| 63 // It returns top platform test directory if |relativePath| was not specified. |
| 64 String platformTestDataPath(const std::string& relativePath = std::string()); |
| 65 |
| 66 PassRefPtr<SharedBuffer> readFromFile(const String& path); |
| 67 |
53 } // namespace testing | 68 } // namespace testing |
54 } // namespace blink | 69 } // namespace blink |
55 | 70 |
56 #endif | 71 #endif |
OLD | NEW |