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 12 matching lines...) Expand all Loading... |
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 #include "platform/testing/UnitTestHelpers.h" | 26 #include "platform/testing/UnitTestHelpers.h" |
27 | 27 |
28 #include "base/files/file_path.h" | 28 #include "base/files/file_path.h" |
29 #include "base/files/file_util.h" | 29 #include "base/files/file_util.h" |
30 #include "base/message_loop/message_loop.h" | 30 #include "base/message_loop/message_loop.h" |
31 #include "base/path_service.h" | 31 #include "base/path_service.h" |
32 #include "platform/SharedBuffer.h" | 32 #include "platform/SharedBuffer.h" |
| 33 #include "platform/Timer.h" |
33 #include "public/platform/FilePathConversion.h" | 34 #include "public/platform/FilePathConversion.h" |
34 #include "public/platform/Platform.h" | 35 #include "public/platform/Platform.h" |
35 #include "public/platform/WebString.h" | 36 #include "public/platform/WebString.h" |
36 #include "public/platform/WebTaskRunner.h" | 37 #include "public/platform/WebTaskRunner.h" |
37 #include "public/platform/WebThread.h" | 38 #include "public/platform/WebThread.h" |
38 #include "public/platform/WebTraceLocation.h" | 39 #include "public/platform/WebTraceLocation.h" |
39 #include "public/platform/WebUnitTestSupport.h" | 40 #include "public/platform/WebUnitTestSupport.h" |
40 #include "wtf/text/StringUTF8Adaptor.h" | 41 #include "wtf/text/StringUTF8Adaptor.h" |
41 | 42 |
42 namespace blink { | 43 namespace blink { |
43 namespace testing { | 44 namespace testing { |
44 | 45 |
45 void runPendingTasks() | 46 void runPendingTasks() |
46 { | 47 { |
47 Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FRO
M_HERE, bind(&exitRunLoop)); | 48 Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FRO
M_HERE, bind(&exitRunLoop)); |
48 enterRunLoop(); | 49 enterRunLoop(); |
49 } | 50 } |
50 | 51 |
| 52 void runDelayedTasks(double delayMs) |
| 53 { |
| 54 Platform::current()->currentThread()->getWebTaskRunner()->postDelayedTask(BL
INK_FROM_HERE, bind(&exitRunLoop), delayMs); |
| 55 enterRunLoop(); |
| 56 } |
| 57 |
51 String blinkRootDir() | 58 String blinkRootDir() |
52 { | 59 { |
53 base::FilePath path; | 60 base::FilePath path; |
54 base::PathService::Get(base::DIR_SOURCE_ROOT, &path); | 61 base::PathService::Get(base::DIR_SOURCE_ROOT, &path); |
55 path = path.Append(FILE_PATH_LITERAL("third_party/WebKit")); | 62 path = path.Append(FILE_PATH_LITERAL("third_party/WebKit")); |
56 path = base::MakeAbsoluteFilePath(path); | 63 path = base::MakeAbsoluteFilePath(path); |
57 return String::fromUTF8(path.MaybeAsASCII().c_str()); | 64 return String::fromUTF8(path.MaybeAsASCII().c_str()); |
58 } | 65 } |
59 | 66 |
60 PassRefPtr<SharedBuffer> readFromFile(const String& path) | 67 PassRefPtr<SharedBuffer> readFromFile(const String& path) |
(...skipping 14 matching lines...) Expand all Loading... |
75 base::MessageLoop::current()->QuitWhenIdle(); | 82 base::MessageLoop::current()->QuitWhenIdle(); |
76 } | 83 } |
77 | 84 |
78 void yieldCurrentThread() | 85 void yieldCurrentThread() |
79 { | 86 { |
80 base::PlatformThread::YieldCurrentThread(); | 87 base::PlatformThread::YieldCurrentThread(); |
81 } | 88 } |
82 | 89 |
83 } // namespace testing | 90 } // namespace testing |
84 } // namespace blink | 91 } // namespace blink |
OLD | NEW |