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

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

Issue 2811793005: Rename LocalFrame::Script() to GetScriptController() (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/ScriptController.h" 9 #include "bindings/core/v8/ScriptController.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 RenderingTest::SetUp(); 43 RenderingTest::SetUp();
44 // Advance timer again as otherwise the time between the first call to 44 // Advance timer again as otherwise the time between the first call to
45 // setInterval and it running will be off by 5us. 45 // setInterval and it running will be off by 5us.
46 platform_->AdvanceClockSeconds(1); 46 platform_->AdvanceClockSeconds(1);
47 GetDocument().GetSettings()->SetScriptEnabled(true); 47 GetDocument().GetSettings()->SetScriptEnabled(true);
48 } 48 }
49 49
50 v8::Local<v8::Value> EvalExpression(const char* expr) { 50 v8::Local<v8::Value> EvalExpression(const char* expr) {
51 return GetDocument() 51 return GetDocument()
52 .GetFrame() 52 .GetFrame()
53 ->Script() 53 ->GetScriptController()
54 .ExecuteScriptInMainWorldAndReturnValue(ScriptSourceCode(expr)); 54 .ExecuteScriptInMainWorldAndReturnValue(ScriptSourceCode(expr));
55 } 55 }
56 56
57 Vector<double> ToDoubleArray(v8::Local<v8::Value> value, 57 Vector<double> ToDoubleArray(v8::Local<v8::Value> value,
58 v8::HandleScope& scope) { 58 v8::HandleScope& scope) {
59 NonThrowableExceptionState exception_state; 59 NonThrowableExceptionState exception_state;
60 return ToImplArray<Vector<double>>(value, 0, scope.GetIsolate(), 60 return ToImplArray<Vector<double>>(value, 0, scope.GetIsolate(),
61 exception_state); 61 exception_state);
62 } 62 }
63 63
64 void ExecuteScriptAndWaitUntilIdle(const char* script_text) { 64 void ExecuteScriptAndWaitUntilIdle(const char* script_text) {
65 ScriptSourceCode script(script_text); 65 ScriptSourceCode script(script_text);
66 GetDocument().GetFrame()->Script().ExecuteScriptInMainWorld(script); 66 GetDocument().GetFrame()->GetScriptController().ExecuteScriptInMainWorld(
67 script);
67 platform_->RunUntilIdle(); 68 platform_->RunUntilIdle();
68 } 69 }
69 }; 70 };
70 71
71 const char* g_k_set_timeout_script_text = 72 const char* g_k_set_timeout_script_text =
72 "var id;" 73 "var id;"
73 "var last = performance.now();" 74 "var last = performance.now();"
74 "var times = [];" 75 "var times = [];"
75 "function nestSetTimeouts() {" 76 "function nestSetTimeouts() {"
76 " var current = performance.now();" 77 " var current = performance.now();"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ExecuteScriptAndWaitUntilIdle(g_k_set_interval_script_text); 128 ExecuteScriptAndWaitUntilIdle(g_k_set_interval_script_text);
128 129
129 auto times(ToDoubleArray(EvalExpression("times"), scope)); 130 auto times(ToDoubleArray(EvalExpression("times"), scope));
130 131
131 EXPECT_THAT(times, ElementsAreArray(kExpectedTimings)); 132 EXPECT_THAT(times, ElementsAreArray(kExpectedTimings));
132 } 133 }
133 134
134 } // namespace 135 } // namespace
135 136
136 } // namespace blink 137 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/EventTargetTest.cpp ('k') | third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698