| 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()));
|
| }
|
| }
|
|
|