OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "core/dom/TaskRunnerHelper.h" | 6 #include "core/dom/TaskRunnerHelper.h" |
7 #include "platform/scheduler/renderer/web_view_scheduler.h" | 7 #include "platform/scheduler/renderer/web_view_scheduler.h" |
8 #include "platform/testing/UnitTestHelpers.h" | 8 #include "platform/testing/UnitTestHelpers.h" |
9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
10 #include "public/web/WebLocalFrame.h" | 10 #include "public/web/WebLocalFrame.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 | 59 |
60 // Some task queues may have repeating v8 tasks that run forever so we impose a | 60 // Some task queues may have repeating v8 tasks that run forever so we impose a |
61 // hard time limit. | 61 // hard time limit. |
62 void RunTasksForPeriod(double delay_ms) { | 62 void RunTasksForPeriod(double delay_ms) { |
63 Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostDelayedTask( | 63 Platform::Current()->CurrentThread()->GetWebTaskRunner()->PostDelayedTask( |
64 BLINK_FROM_HERE, WTF::Bind(&QuitRunLoop), | 64 BLINK_FROM_HERE, WTF::Bind(&QuitRunLoop), |
65 TimeDelta::FromMillisecondsD(delay_ms)); | 65 TimeDelta::FromMillisecondsD(delay_ms)); |
66 testing::EnterRunLoop(); | 66 testing::EnterRunLoop(); |
67 } | 67 } |
68 } | 68 } // namespace |
69 | 69 |
70 // http://crbug.com/633321 | 70 // http://crbug.com/633321 |
71 #if OS(ANDROID) | 71 #if OS(ANDROID) |
72 #define MAYBE_DOMTimersFireInExpectedOrder DISABLED_DOMTimersFireInExpectedOrder | 72 #define MAYBE_DOMTimersFireInExpectedOrder DISABLED_DOMTimersFireInExpectedOrder |
73 #else | 73 #else |
74 #define MAYBE_DOMTimersFireInExpectedOrder DOMTimersFireInExpectedOrder | 74 #define MAYBE_DOMTimersFireInExpectedOrder DOMTimersFireInExpectedOrder |
75 #endif | 75 #endif |
76 TEST_F(VirtualTimeTest, MAYBE_DOMTimersFireInExpectedOrder) { | 76 TEST_F(VirtualTimeTest, MAYBE_DOMTimersFireInExpectedOrder) { |
77 WebView().Scheduler()->EnableVirtualTime(); | 77 WebView().Scheduler()->EnableVirtualTime(); |
78 | 78 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // ALso schedule a third timer for the same point in time. | 230 // ALso schedule a third timer for the same point in time. |
231 ExecuteJavaScript("setTimeout(() => { run_order.push(2); }, 1000);"); | 231 ExecuteJavaScript("setTimeout(() => { run_order.push(2); }, 1000);"); |
232 | 232 |
233 // The second DOM timer shouldn't have run because the virtual time budget | 233 // The second DOM timer shouldn't have run because the virtual time budget |
234 // expired. | 234 // expired. |
235 testing::RunPendingTasks(); | 235 testing::RunPendingTasks(); |
236 EXPECT_EQ("1, 2", ExecuteJavaScript("run_order.join(', ')")); | 236 EXPECT_EQ("1, 2", ExecuteJavaScript("run_order.join(', ')")); |
237 } | 237 } |
238 | 238 |
239 } // namespace blink | 239 } // namespace blink |
OLD | NEW |