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

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

Issue 2810843002: bindings: Make the sequence conversion code more complaint with WebIDL. (Closed)
Patch Set: Adjust even more tests Created 3 years, 8 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
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"
10 #include "bindings/core/v8/NativeValueTraitsImpl.h"
9 #include "bindings/core/v8/ScriptController.h" 11 #include "bindings/core/v8/ScriptController.h"
10 #include "bindings/core/v8/ScriptSourceCode.h" 12 #include "bindings/core/v8/ScriptSourceCode.h"
11 #include "bindings/core/v8/V8Binding.h" 13 #include "bindings/core/v8/V8Binding.h"
12 #include "core/dom/Document.h" 14 #include "core/dom/Document.h"
13 #include "core/layout/LayoutTestHelper.h" 15 #include "core/layout/LayoutTestHelper.h"
14 #include "platform/testing/TestingPlatformSupport.h" 16 #include "platform/testing/TestingPlatformSupport.h"
15 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
17 19
18 using testing::DoubleNear; 20 using testing::DoubleNear;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 v8::Local<v8::Value> EvalExpression(const char* expr) { 55 v8::Local<v8::Value> EvalExpression(const char* expr) {
54 return GetDocument() 56 return GetDocument()
55 .GetFrame() 57 .GetFrame()
56 ->GetScriptController() 58 ->GetScriptController()
57 .ExecuteScriptInMainWorldAndReturnValue(ScriptSourceCode(expr)); 59 .ExecuteScriptInMainWorldAndReturnValue(ScriptSourceCode(expr));
58 } 60 }
59 61
60 Vector<double> ToDoubleArray(v8::Local<v8::Value> value, 62 Vector<double> ToDoubleArray(v8::Local<v8::Value> value,
61 v8::HandleScope& scope) { 63 v8::HandleScope& scope) {
62 NonThrowableExceptionState exception_state; 64 NonThrowableExceptionState exception_state;
63 return ToImplArray<Vector<double>>(value, 0, scope.GetIsolate(), 65 return NativeValueTraits<IDLSequence<IDLDouble>>::NativeValue(
64 exception_state); 66 scope.GetIsolate(), value, exception_state);
65 } 67 }
66 68
67 double ToDoubleValue(v8::Local<v8::Value> value, v8::HandleScope& scope) { 69 double ToDoubleValue(v8::Local<v8::Value> value, v8::HandleScope& scope) {
68 NonThrowableExceptionState exceptionState; 70 NonThrowableExceptionState exceptionState;
69 return ToDouble(scope.GetIsolate(), value, exceptionState); 71 return ToDouble(scope.GetIsolate(), value, exceptionState);
70 } 72 }
71 73
72 void ExecuteScriptAndWaitUntilIdle(const char* script_text) { 74 void ExecuteScriptAndWaitUntilIdle(const char* script_text) {
73 ScriptSourceCode script(script_text); 75 ScriptSourceCode script(script_text);
74 GetDocument().GetFrame()->GetScriptController().ExecuteScriptInMainWorld( 76 GetDocument().GetFrame()->GetScriptController().ExecuteScriptInMainWorld(
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 ExecuteScriptAndWaitUntilIdle(kSetIntervalScriptText); 157 ExecuteScriptAndWaitUntilIdle(kSetIntervalScriptText);
156 158
157 auto times(ToDoubleArray(EvalExpression("times"), scope)); 159 auto times(ToDoubleArray(EvalExpression("times"), scope));
158 160
159 EXPECT_THAT(times, ElementsAreArray(kExpectedTimings)); 161 EXPECT_THAT(times, ElementsAreArray(kExpectedTimings));
160 } 162 }
161 163
162 } // namespace 164 } // namespace
163 165
164 } // namespace blink 166 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core_idl_files.gni ('k') | third_party/WebKit/Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698