| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |