OLD | NEW |
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/testing/DummyPageHolder.h" | 9 #include "core/testing/DummyPageHolder.h" |
10 #include "core/timing/PerformanceBase.h" | 10 #include "core/timing/PerformanceBase.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 DEFINE_INLINE_TRACE() { PerformanceBase::trace(visitor); } | 33 DEFINE_INLINE_TRACE() { PerformanceBase::trace(visitor); } |
34 }; | 34 }; |
35 | 35 |
36 class PerformanceBaseTest : public ::testing::Test { | 36 class PerformanceBaseTest : public ::testing::Test { |
37 protected: | 37 protected: |
38 void initialize(ScriptState* scriptState) { | 38 void initialize(ScriptState* scriptState) { |
39 v8::Local<v8::Function> callback = | 39 v8::Local<v8::Function> callback = |
40 v8::Function::New(scriptState->context(), nullptr).ToLocalChecked(); | 40 v8::Function::New(scriptState->context(), nullptr).ToLocalChecked(); |
41 m_base = new TestPerformanceBase(); | 41 m_base = new TestPerformanceBase(); |
42 m_cb = PerformanceObserverCallback::create(scriptState, callback); | 42 m_cb = PerformanceObserverCallback::create(scriptState, callback); |
43 m_observer = PerformanceObserver::create(scriptState, m_base, m_cb); | 43 m_observer = PerformanceObserver::create(scriptState->getExecutionContext(), |
| 44 m_base, m_cb); |
44 } | 45 } |
45 | 46 |
46 void SetUp() override { | 47 void SetUp() override { |
47 m_pageHolder = DummyPageHolder::create(IntSize(800, 600)); | 48 m_pageHolder = DummyPageHolder::create(IntSize(800, 600)); |
48 } | 49 } |
49 | 50 |
50 int numPerformanceEntriesInObserver() { | 51 int numPerformanceEntriesInObserver() { |
51 return m_observer->m_performanceEntries.size(); | 52 return m_observer->m_performanceEntries.size(); |
52 } | 53 } |
53 | 54 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 EXPECT_EQ(returnedType, | 138 EXPECT_EQ(returnedType, |
138 PerformanceNavigationTiming::NavigationType::BackForward); | 139 PerformanceNavigationTiming::NavigationType::BackForward); |
139 | 140 |
140 m_pageHolder->page().setVisibilityState(PageVisibilityStateVisible, false); | 141 m_pageHolder->page().setVisibilityState(PageVisibilityStateVisible, false); |
141 returnedType = getNavigationType(NavigationTypeFormResubmitted, | 142 returnedType = getNavigationType(NavigationTypeFormResubmitted, |
142 &m_pageHolder->document()); | 143 &m_pageHolder->document()); |
143 EXPECT_EQ(returnedType, | 144 EXPECT_EQ(returnedType, |
144 PerformanceNavigationTiming::NavigationType::Navigate); | 145 PerformanceNavigationTiming::NavigationType::Navigate); |
145 } | 146 } |
146 } // namespace blink | 147 } // namespace blink |
OLD | NEW |