| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 Document* document() const { return &m_pageHolder->document(); } | 43 Document* document() const { return &m_pageHolder->document(); } |
| 44 | 44 |
| 45 LocalFrame* anotherFrame() const { | 45 LocalFrame* anotherFrame() const { |
| 46 return m_anotherPageHolder->document().frame(); | 46 return m_anotherPageHolder->document().frame(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 Document* anotherDocument() const { return &m_anotherPageHolder->document(); } | 49 Document* anotherDocument() const { return &m_anotherPageHolder->document(); } |
| 50 | 50 |
| 51 String sanitizedAttribution(ExecutionContext* context, | 51 String sanitizedAttribution(ExecutionContext* context, |
| 52 bool hasMultipleContexts, | 52 bool hasMultipleContexts, |
| 53 Frame* observerFrame) { | 53 LocalFrame* observerFrame) { |
| 54 return Performance::sanitizedAttribution(context, hasMultipleContexts, | 54 return Performance::sanitizedAttribution(context, hasMultipleContexts, |
| 55 observerFrame) | 55 observerFrame) |
| 56 .first; | 56 .first; |
| 57 } | 57 } |
| 58 | 58 |
| 59 Persistent<Performance> m_performance; | 59 Persistent<Performance> m_performance; |
| 60 std::unique_ptr<DummyPageHolder> m_pageHolder; | 60 std::unique_ptr<DummyPageHolder> m_pageHolder; |
| 61 std::unique_ptr<DummyPageHolder> m_anotherPageHolder; | 61 std::unique_ptr<DummyPageHolder> m_anotherPageHolder; |
| 62 }; | 62 }; |
| 63 | 63 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 90 | 90 |
| 91 TEST_F(PerformanceTest, SanitizedLongTaskName_CrossOrigin) { | 91 TEST_F(PerformanceTest, SanitizedLongTaskName_CrossOrigin) { |
| 92 // Unable to attribute, when no execution contents are available. | 92 // Unable to attribute, when no execution contents are available. |
| 93 EXPECT_EQ("unknown", sanitizedAttribution(nullptr, false, frame())); | 93 EXPECT_EQ("unknown", sanitizedAttribution(nullptr, false, frame())); |
| 94 | 94 |
| 95 // Attribute for same context (and same origin). | 95 // Attribute for same context (and same origin). |
| 96 EXPECT_EQ("cross-origin-unreachable", | 96 EXPECT_EQ("cross-origin-unreachable", |
| 97 sanitizedAttribution(anotherDocument(), false, frame())); | 97 sanitizedAttribution(anotherDocument(), false, frame())); |
| 98 } | 98 } |
| 99 } | 99 } |
| OLD | NEW |