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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorWebPerfAgentTest.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 side-by-side diff with in-line comments
Download patch
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 0ec06dbf91af6efaea42000aab55be819b3e64ec..ba29066fe0013a71b59187dfea7e6cb6be320381 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgentTest.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgentTest.cpp
@@ -34,7 +34,8 @@ class InspectorWebPerfAgentTest : public ::testing::Test {
String sanitizedLongTaskName(
HeapHashSet<Member<Location>> frameContextLocations,
Frame* rootFrame) {
- return m_agent->sanitizedLongTaskName(frameContextLocations, rootFrame);
+ return m_agent->sanitizedAttribution(frameContextLocations, rootFrame)
+ .first;
}
Persistent<InspectorWebPerfAgent> m_agent;
@@ -135,7 +136,7 @@ TEST_F(InspectorWebPerfAgentTest, SanitizedLongTaskName) {
// Attribute for same context (and same origin).
frameContextLocations.add(Location::create(frame()));
- EXPECT_EQ("https://example.com/foo",
+ EXPECT_EQ("same-origin",
sanitizedLongTaskName(frameContextLocations, frame()));
// Unable to attribute, when multiple script execution contents are involved.
@@ -144,4 +145,15 @@ TEST_F(InspectorWebPerfAgentTest, SanitizedLongTaskName) {
sanitizedLongTaskName(frameContextLocations, frame()));
}
+TEST_F(InspectorWebPerfAgentTest, SanitizedLongTaskName_CrossOrigin) {
+ 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(anotherFrame()));
+ EXPECT_EQ("cross-origin-unreachable",
+ sanitizedLongTaskName(frameContextLocations, frame()));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698