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

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp

Issue 2811863002: Move ScriptState::GetExecutionContext (Part 4) (Closed)
Patch Set: Fix Document.cpp 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/timing/Performance.h" 5 #include "core/timing/Performance.h"
6 6
7 #include "bindings/core/v8/PerformanceObserverCallback.h" 7 #include "bindings/core/v8/PerformanceObserverCallback.h"
8 #include "bindings/core/v8/V8BindingForTesting.h" 8 #include "bindings/core/v8/V8BindingForTesting.h"
9 #include "core/dom/ExecutionContext.h"
9 #include "core/dom/TaskRunnerHelper.h" 10 #include "core/dom/TaskRunnerHelper.h"
10 #include "core/testing/DummyPageHolder.h" 11 #include "core/testing/DummyPageHolder.h"
11 #include "core/testing/NullExecutionContext.h" 12 #include "core/testing/NullExecutionContext.h"
12 #include "core/timing/PerformanceBase.h" 13 #include "core/timing/PerformanceBase.h"
13 #include "core/timing/PerformanceLongTaskTiming.h" 14 #include "core/timing/PerformanceLongTaskTiming.h"
14 #include "core/timing/PerformanceObserver.h" 15 #include "core/timing/PerformanceObserver.h"
15 #include "core/timing/PerformanceObserverInit.h" 16 #include "core/timing/PerformanceObserverInit.h"
16 #include "platform/loader/fetch/ResourceResponse.h" 17 #include "platform/loader/fetch/ResourceResponse.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
(...skipping 20 matching lines...) Expand all
39 DEFINE_INLINE_TRACE() { PerformanceBase::Trace(visitor); } 40 DEFINE_INLINE_TRACE() { PerformanceBase::Trace(visitor); }
40 }; 41 };
41 42
42 class PerformanceBaseTest : public ::testing::Test { 43 class PerformanceBaseTest : public ::testing::Test {
43 protected: 44 protected:
44 void Initialize(ScriptState* script_state) { 45 void Initialize(ScriptState* script_state) {
45 v8::Local<v8::Function> callback = 46 v8::Local<v8::Function> callback =
46 v8::Function::New(script_state->GetContext(), nullptr).ToLocalChecked(); 47 v8::Function::New(script_state->GetContext(), nullptr).ToLocalChecked();
47 base_ = new TestPerformanceBase(script_state); 48 base_ = new TestPerformanceBase(script_state);
48 cb_ = PerformanceObserverCallback::Create(script_state, callback); 49 cb_ = PerformanceObserverCallback::Create(script_state, callback);
49 observer_ = PerformanceObserver::Create(script_state->GetExecutionContext(), 50 observer_ = PerformanceObserver::Create(
50 base_, cb_); 51 ExecutionContext::From(script_state), base_, cb_);
51 } 52 }
52 53
53 void SetUp() override { 54 void SetUp() override {
54 page_holder_ = DummyPageHolder::Create(IntSize(800, 600)); 55 page_holder_ = DummyPageHolder::Create(IntSize(800, 600));
55 execution_context_ = new NullExecutionContext(); 56 execution_context_ = new NullExecutionContext();
56 } 57 }
57 58
58 ExecutionContext* GetExecutionContext() { return execution_context_.Get(); } 59 ExecutionContext* GetExecutionContext() { return execution_context_.Get(); }
59 60
60 int NumPerformanceEntriesInObserver() { 61 int NumPerformanceEntriesInObserver() {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 172
172 // When cross-origin redirect opts in. 173 // When cross-origin redirect opts in.
173 redirect_chain.back().SetHTTPHeaderField(HTTPNames::Timing_Allow_Origin, 174 redirect_chain.back().SetHTTPHeaderField(HTTPNames::Timing_Allow_Origin,
174 origin_domain); 175 origin_domain);
175 EXPECT_TRUE(AllowsTimingRedirect(redirect_chain, final_response, 176 EXPECT_TRUE(AllowsTimingRedirect(redirect_chain, final_response,
176 *security_origin.Get(), 177 *security_origin.Get(),
177 GetExecutionContext())); 178 GetExecutionContext()));
178 } 179 }
179 180
180 } // namespace blink 181 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698