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

Side by Side Diff: third_party/WebKit/Source/core/frame/DOMTimerTest.cpp

Issue 2853493002: Restore one millisecond minimum timeout for setTimeout. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMTimer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "core/frame/DOMTimer.h" 5 #include "core/frame/DOMTimer.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "bindings/core/v8/IDLTypes.h" 9 #include "bindings/core/v8/IDLTypes.h"
10 #include "bindings/core/v8/NativeValueTraitsImpl.h" 10 #include "bindings/core/v8/NativeValueTraitsImpl.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 const char* const kSetTimeout0ScriptText = 81 const char* const kSetTimeout0ScriptText =
82 "var last = performance.now();" 82 "var last = performance.now();"
83 "var elapsed;" 83 "var elapsed;"
84 "function setTimeoutCallback() {" 84 "function setTimeoutCallback() {"
85 " var current = performance.now();" 85 " var current = performance.now();"
86 " elapsed = current - last;" 86 " elapsed = current - last;"
87 "}" 87 "}"
88 "setTimeout(setTimeoutCallback, 0);"; 88 "setTimeout(setTimeoutCallback, 0);";
89 89
90 TEST_F(DOMTimerTest, setTimeout_ZeroIsNotClampedToOne) { 90 TEST_F(DOMTimerTest, DISABLED_setTimeout_ZeroIsNotClampedToOne) {
91 v8::HandleScope scope(v8::Isolate::GetCurrent()); 91 v8::HandleScope scope(v8::Isolate::GetCurrent());
92 92
93 ExecuteScriptAndWaitUntilIdle(kSetTimeout0ScriptText); 93 ExecuteScriptAndWaitUntilIdle(kSetTimeout0ScriptText);
94 94
95 double time = ToDoubleValue(EvalExpression("elapsed"), scope); 95 double time = ToDoubleValue(EvalExpression("elapsed"), scope);
96 96
97 EXPECT_THAT(time, DoubleNear(0., kThreshold)); 97 EXPECT_THAT(time, DoubleNear(0., kThreshold));
98 } 98 }
99 99
100 const char* const kSetTimeoutNestedScriptText = 100 const char* const kSetTimeoutNestedScriptText =
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 ExecuteScriptAndWaitUntilIdle(kSetIntervalScriptText); 155 ExecuteScriptAndWaitUntilIdle(kSetIntervalScriptText);
156 156
157 auto times(ToDoubleArray(EvalExpression("times"), scope)); 157 auto times(ToDoubleArray(EvalExpression("times"), scope));
158 158
159 EXPECT_THAT(times, ElementsAreArray(kExpectedTimings)); 159 EXPECT_THAT(times, ElementsAreArray(kExpectedTimings));
160 } 160 }
161 161
162 } // namespace 162 } // namespace
163 163
164 } // namespace blink 164 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMTimer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698