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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorWebPerfAgentTest.cpp

Issue 2346133002: Generate long task timing entries when long task is reported. (Closed)
Patch Set: sync to base CL 2343553005 Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorWebPerfAgent.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/inspector/InspectorWebPerfAgentTest.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgentTest.cpp b/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgentTest.cpp
index ff5fd7c4d11053dd51b4d6ab15f561692d6ee2f6..d673fb55cef95f75d31a6f94196eb5e28190b673 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgentTest.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgentTest.cpp
@@ -19,11 +19,17 @@ protected:
void SetUp() override;
LocalFrame* frame() const { return m_pageHolder->document().frame(); }
ExecutionContext* executionContext() const { return &m_pageHolder->document(); }
+ LocalFrame* anotherFrame() const { return m_anotherPageHolder->document().frame(); }
ExecutionContext* anotherExecutionContext() const { return &m_anotherPageHolder->document(); }
String frameContextURL();
int numUniqueFrameContextsSeen();
+ String sanitizedLongTaskName(
+ HeapHashSet<Member<Location>> frameContextLocations, Frame* rootFrame) {
+ return m_agent->sanitizedLongTaskName(frameContextLocations, rootFrame);
+ }
+
Persistent<InspectorWebPerfAgent> m_agent;
std::unique_ptr<DummyPageHolder> m_pageHolder;
std::unique_ptr<DummyPageHolder> m_anotherPageHolder;
@@ -46,8 +52,7 @@ String InspectorWebPerfAgentTest::frameContextURL()
if (m_agent->m_frameContextLocations.size() != 1)
return "";
Location* location = (*m_agent->m_frameContextLocations.begin()).get();
- return String(location->protocol()) + "//"
- + location->hostname() + location->pathname();
+ return location->href();
}
int InspectorWebPerfAgentTest::numUniqueFrameContextsSeen()
@@ -118,4 +123,22 @@ TEST_F(InspectorWebPerfAgentTest, NoScriptInLongTask)
EXPECT_EQ(0, numUniqueFrameContextsSeen());
}
+TEST_F(InspectorWebPerfAgentTest, SanitizedLongTaskName)
+{
+ HeapHashSet<Member<Location>> frameContextLocations;
+ // Unable to attribute, when no execution contents are available.
+ EXPECT_EQ("unknown",
+ sanitizedLongTaskName(frameContextLocations, frame()));
+
+ // Attribute for same context (and same origin).
+ frameContextLocations.add(Location::create(frame()));
+ EXPECT_EQ("https://example.com/foo",
+ sanitizedLongTaskName(frameContextLocations, frame()));
+
+ // Unable to attribute, when multiple script execution contents are involved.
+ frameContextLocations.add(Location::create(frame()));
+ EXPECT_EQ("multiple-contexts",
+ sanitizedLongTaskName(frameContextLocations, frame()));
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorWebPerfAgent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698