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 "core/frame/PerformanceMonitor.h" | 7 #include "core/frame/PerformanceMonitor.h" |
8 #include "core/testing/DummyPageHolder.h" | 8 #include "core/testing/DummyPageHolder.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 removeLongTaskObserver(); | 74 removeLongTaskObserver(); |
75 m_performance->updateLongTaskInstrumentation(); | 75 m_performance->updateLongTaskInstrumentation(); |
76 EXPECT_FALSE(observingLongTasks()); | 76 EXPECT_FALSE(observingLongTasks()); |
77 } | 77 } |
78 | 78 |
79 TEST_F(PerformanceTest, SanitizedLongTaskName) { | 79 TEST_F(PerformanceTest, SanitizedLongTaskName) { |
80 // Unable to attribute, when no execution contents are available. | 80 // Unable to attribute, when no execution contents are available. |
81 EXPECT_EQ("unknown", sanitizedAttribution(nullptr, false, frame())); | 81 EXPECT_EQ("unknown", sanitizedAttribution(nullptr, false, frame())); |
82 | 82 |
83 // Attribute for same context (and same origin). | 83 // Attribute for same context (and same origin). |
84 EXPECT_EQ("same-origin-self", | 84 EXPECT_EQ("self", sanitizedAttribution(document(), false, frame())); |
85 sanitizedAttribution(document(), false, frame())); | |
86 | 85 |
87 // Unable to attribute, when multiple script execution contents are involved. | 86 // Unable to attribute, when multiple script execution contents are involved. |
88 EXPECT_EQ("multiple-contexts", | 87 EXPECT_EQ("multiple-contexts", |
89 sanitizedAttribution(document(), true, frame())); | 88 sanitizedAttribution(document(), true, frame())); |
90 } | 89 } |
91 | 90 |
92 TEST_F(PerformanceTest, SanitizedLongTaskName_CrossOrigin) { | 91 TEST_F(PerformanceTest, SanitizedLongTaskName_CrossOrigin) { |
93 // Unable to attribute, when no execution contents are available. | 92 // Unable to attribute, when no execution contents are available. |
94 EXPECT_EQ("unknown", sanitizedAttribution(nullptr, false, frame())); | 93 EXPECT_EQ("unknown", sanitizedAttribution(nullptr, false, frame())); |
95 | 94 |
96 // Attribute for same context (and same origin). | 95 // Attribute for same context (and same origin). |
97 EXPECT_EQ("cross-origin-unreachable", | 96 EXPECT_EQ("cross-origin-unreachable", |
98 sanitizedAttribution(anotherDocument(), false, frame())); | 97 sanitizedAttribution(anotherDocument(), false, frame())); |
99 } | 98 } |
100 } | 99 } |
OLD | NEW |