Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1084)

Unified Diff: third_party/WebKit/Source/web/tests/VirtualTimeTest.cpp

Issue 2909293002: Allow tasks scheduled for the instant virtual time budges expires to run (Closed)
Patch Set: Changes for altimin@ Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/tests/VirtualTimeTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/VirtualTimeTest.cpp b/third_party/WebKit/Source/web/tests/VirtualTimeTest.cpp
index 1176d909190919cf8aec3cebe47e3c609f88342a..2d68ce9b41e63d280f9c5d63ab6fd191616e626c 100644
--- a/third_party/WebKit/Source/web/tests/VirtualTimeTest.cpp
+++ b/third_party/WebKit/Source/web/tests/VirtualTimeTest.cpp
@@ -208,10 +208,11 @@ TEST_F(VirtualTimeTest,
TEST_F(VirtualTimeTest, MAYBE_DOMTimersSuspended) {
WebView().Scheduler()->EnableVirtualTime();
- // Schedule a normal DOM timer to run at 1s in the future.
+ // Schedule normal DOM timers to run at 1s and 1.001s in the future.
ExecuteJavaScript(
"var run_order = [];"
- "setTimeout(() => { run_order.push(1); }, 1000);");
+ "setTimeout(() => { run_order.push(1); }, 1000);"
+ "setTimeout(() => { run_order.push(2); }, 1001);");
RefPtr<WebTaskRunner> runner =
TaskRunnerHelper::Get(TaskType::kTimer, Window().GetExecutionContext());
@@ -226,13 +227,13 @@ TEST_F(VirtualTimeTest, MAYBE_DOMTimersSuspended) {
WTF::Unretained(WebView().Scheduler())),
TimeDelta::FromMilliseconds(1000));
- // ALso schedule a second timer for the same point in time.
+ // ALso schedule a third timer for the same point in time.
ExecuteJavaScript("setTimeout(() => { run_order.push(2); }, 1000);");
- // The second DOM timer shouldn't have run because pausing virtual time also
- // atomically pauses DOM timers.
+ // The second DOM timer shouldn't have run because the virtual time budget
+ // expired.
testing::RunPendingTasks();
- EXPECT_EQ("1", ExecuteJavaScript("run_order.join(', ')"));
+ EXPECT_EQ("1, 2", ExecuteJavaScript("run_order.join(', ')"));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698