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

Unified Diff: third_party/WebKit/Source/core/timing/PerformanceTest.cpp

Issue 2539323002: PerformanceMonitor: do not maintain a vector of frames in the monitor, single ExecutionContext memb… (Closed)
Patch Set: off-by-one in depth fixed Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/timing/Performance.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/timing/PerformanceTest.cpp
diff --git a/third_party/WebKit/Source/core/timing/PerformanceTest.cpp b/third_party/WebKit/Source/core/timing/PerformanceTest.cpp
index 5f2807cca69cd9983d6ef8ad54a45b481fbab9d8..7a07e9d0537c65face1716bd1902d497815666ab 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceTest.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceTest.cpp
@@ -40,13 +40,20 @@ class PerformanceTest : public ::testing::Test {
LocalFrame* frame() const { return m_pageHolder->document().frame(); }
+ Document* document() const { return &m_pageHolder->document(); }
+
LocalFrame* anotherFrame() const {
return m_anotherPageHolder->document().frame();
}
- String sanitizedAttribution(const HeapHashSet<Member<Frame>>& frames,
+ Document* anotherDocument() const { return &m_anotherPageHolder->document(); }
+
+ String sanitizedAttribution(ExecutionContext* context,
+ bool hasMultipleContexts,
Frame* observerFrame) {
- return Performance::sanitizedAttribution(frames, observerFrame).first;
+ return Performance::sanitizedAttribution(context, hasMultipleContexts,
+ observerFrame)
+ .first;
}
Persistent<Performance> m_performance;
@@ -70,27 +77,23 @@ TEST_F(PerformanceTest, LongTaskObserverInstrumentation) {
}
TEST_F(PerformanceTest, SanitizedLongTaskName) {
- HeapHashSet<Member<Frame>> frameContexts;
// Unable to attribute, when no execution contents are available.
- EXPECT_EQ("unknown", sanitizedAttribution(frameContexts, frame()));
+ EXPECT_EQ("unknown", sanitizedAttribution(nullptr, false, frame()));
// Attribute for same context (and same origin).
- frameContexts.add(frame());
- EXPECT_EQ("same-origin", sanitizedAttribution(frameContexts, frame()));
+ EXPECT_EQ("same-origin", sanitizedAttribution(document(), false, frame()));
// Unable to attribute, when multiple script execution contents are involved.
- frameContexts.add(anotherFrame());
- EXPECT_EQ("multiple-contexts", sanitizedAttribution(frameContexts, frame()));
+ EXPECT_EQ("multiple-contexts",
+ sanitizedAttribution(document(), true, frame()));
}
TEST_F(PerformanceTest, SanitizedLongTaskName_CrossOrigin) {
- HeapHashSet<Member<Frame>> frameContexts;
// Unable to attribute, when no execution contents are available.
- EXPECT_EQ("unknown", sanitizedAttribution(frameContexts, frame()));
+ EXPECT_EQ("unknown", sanitizedAttribution(nullptr, false, frame()));
// Attribute for same context (and same origin).
- frameContexts.add(anotherFrame());
EXPECT_EQ("cross-origin-unreachable",
- sanitizedAttribution(frameContexts, frame()));
+ sanitizedAttribution(anotherDocument(), false, frame()));
}
}
« no previous file with comments | « third_party/WebKit/Source/core/timing/Performance.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698