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

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

Issue 2386403002: Pass DOMWinow to PerformanceLongTaskTiming for attribution (Closed)
Patch Set: sync and rebase Created 4 years, 2 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/timing/PerformanceBase.h" 9 #include "core/timing/PerformanceBase.h"
10 #include "core/timing/PerformanceLongTaskTiming.h" 10 #include "core/timing/PerformanceLongTaskTiming.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 m_base->unregisterPerformanceObserver(*m_observer.get()); 80 m_base->unregisterPerformanceObserver(*m_observer.get());
81 EXPECT_EQ(0, m_base->numObservers()); 81 EXPECT_EQ(0, m_base->numObservers());
82 EXPECT_EQ(0, m_base->numActiveObservers()); 82 EXPECT_EQ(0, m_base->numActiveObservers());
83 } 83 }
84 84
85 TEST_F(PerformanceBaseTest, AddLongTaskTiming) { 85 TEST_F(PerformanceBaseTest, AddLongTaskTiming) {
86 V8TestingScope scope; 86 V8TestingScope scope;
87 initialize(scope.getScriptState()); 87 initialize(scope.getScriptState());
88 88
89 // Add a long task entry, but no observer registered. 89 // Add a long task entry, but no observer registered.
90 m_base->addLongTaskTiming(1234, 5678, "www.foo.com/bar"); 90 m_base->addLongTaskTiming(1234, 5678, "www.foo.com/bar", nullptr);
91 EXPECT_EQ(0, m_base->numLongTaskTimingEntries()); // has no effect 91 EXPECT_EQ(0, m_base->numLongTaskTimingEntries()); // has no effect
92 92
93 // Make an observer for longtask 93 // Make an observer for longtask
94 NonThrowableExceptionState exceptionState; 94 NonThrowableExceptionState exceptionState;
95 PerformanceObserverInit options; 95 PerformanceObserverInit options;
96 Vector<String> entryTypeVec; 96 Vector<String> entryTypeVec;
97 entryTypeVec.append("longtask"); 97 entryTypeVec.append("longtask");
98 options.setEntryTypes(entryTypeVec); 98 options.setEntryTypes(entryTypeVec);
99 m_observer->observe(options, exceptionState); 99 m_observer->observe(options, exceptionState);
100 100
101 // Add a long task entry 101 // Add a long task entry
102 m_base->addLongTaskTiming(1234, 5678, "www.foo.com/bar"); 102 m_base->addLongTaskTiming(1234, 5678, "www.foo.com/bar", nullptr);
103 EXPECT_EQ(1, m_base->numLongTaskTimingEntries()); // added an entry 103 EXPECT_EQ(1, m_base->numLongTaskTimingEntries()); // added an entry
104 } 104 }
105 105
106 } // namespace blink 106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698