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

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: 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/V8Binding.h" 12 #include "bindings/core/v8/V8Binding.h"
11 #include "core/dom/Document.h" 13 #include "core/dom/Document.h"
12 #include "core/layout/LayoutTestHelper.h" 14 #include "core/layout/LayoutTestHelper.h"
13 #include "platform/testing/TestingPlatformSupport.h" 15 #include "platform/testing/TestingPlatformSupport.h"
14 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
16 18
17 using testing::DoubleNear; 19 using testing::DoubleNear;
18 using testing::ElementsAreArray; 20 using testing::ElementsAreArray;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 v8::Local<v8::Value> EvalExpression(const char* expr) { 52 v8::Local<v8::Value> EvalExpression(const char* expr) {
51 return GetDocument() 53 return GetDocument()
52 .GetFrame() 54 .GetFrame()
53 ->Script() 55 ->Script()
54 .ExecuteScriptInMainWorldAndReturnValue(ScriptSourceCode(expr)); 56 .ExecuteScriptInMainWorldAndReturnValue(ScriptSourceCode(expr));
55 } 57 }
56 58
57 Vector<double> ToDoubleArray(v8::Local<v8::Value> value, 59 Vector<double> ToDoubleArray(v8::Local<v8::Value> value,
58 v8::HandleScope& scope) { 60 v8::HandleScope& scope) {
59 NonThrowableExceptionState exception_state; 61 NonThrowableExceptionState exception_state;
60 return ToImplArray<Vector<double>>(value, 0, scope.GetIsolate(), 62 return NativeValueTraits<IDLSequence<IDLDouble>>::NativeValue(
61 exception_state); 63 scope.GetIsolate(), value, exception_state);
62 } 64 }
63 65
64 void ExecuteScriptAndWaitUntilIdle(const char* script_text) { 66 void ExecuteScriptAndWaitUntilIdle(const char* script_text) {
65 ScriptSourceCode script(script_text); 67 ScriptSourceCode script(script_text);
66 GetDocument().GetFrame()->Script().ExecuteScriptInMainWorld(script); 68 GetDocument().GetFrame()->Script().ExecuteScriptInMainWorld(script);
67 platform_->RunUntilIdle(); 69 platform_->RunUntilIdle();
68 } 70 }
69 }; 71 };
70 72
71 const char* g_k_set_timeout_script_text = 73 const char* g_k_set_timeout_script_text =
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ExecuteScriptAndWaitUntilIdle(g_k_set_interval_script_text); 129 ExecuteScriptAndWaitUntilIdle(g_k_set_interval_script_text);
128 130
129 auto times(ToDoubleArray(EvalExpression("times"), scope)); 131 auto times(ToDoubleArray(EvalExpression("times"), scope));
130 132
131 EXPECT_THAT(times, ElementsAreArray(kExpectedTimings)); 133 EXPECT_THAT(times, ElementsAreArray(kExpectedTimings));
132 } 134 }
133 135
134 } // namespace 136 } // namespace
135 137
136 } // namespace blink 138 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698