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

Unified Diff: third_party/WebKit/Source/core/frame/LocalFrameTest.cpp

Issue 2449673002: Refactor InspectorWebPerfAgent: update lifecycle management to be per Local Frame root; replace hea… (Closed)
Patch Set: sync and rebase Created 4 years, 1 month 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/frame/LocalFrameTest.cpp
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameTest.cpp b/third_party/WebKit/Source/core/frame/LocalFrameTest.cpp
index 4a17fceea3567e46a3a5470a72b332d2fc4dc235..212c4144e1402126903adb62dcad8bc6836a1fb2 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrameTest.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrameTest.cpp
@@ -9,8 +9,10 @@
#include "core/frame/FrameView.h"
#include "core/frame/VisualViewport.h"
#include "core/html/HTMLElement.h"
+#include "core/inspector/InspectorWebPerfAgent.h"
#include "core/layout/LayoutObject.h"
#include "core/testing/DummyPageHolder.h"
+#include "core/timing/Performance.h"
#include "platform/DragImage.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -23,6 +25,7 @@ class LocalFrameTest : public ::testing::Test {
Document& document() const { return m_dummyPageHolder->document(); }
LocalFrame& frame() const { return *document().frame(); }
+ Performance* performance() const { return m_performance; }
void setBodyContent(const std::string& bodyContent) {
document().body()->setInnerHTML(String::fromUTF8(bodyContent.c_str()),
@@ -34,12 +37,19 @@ class LocalFrameTest : public ::testing::Test {
document().view()->updateAllLifecyclePhases();
}
+ bool hasWebPerformanceAgent() { return frame().m_inspectorWebPerfAgent; }
+ bool hasWebPerformanceAgentObservers() {
+ return frame().m_inspectorWebPerfAgent->hasWebPerformanceObservers();
+ }
+
private:
void SetUp() override {
m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
+ m_performance = Performance::create(&frame());
}
std::unique_ptr<DummyPageHolder> m_dummyPageHolder;
+ Persistent<Performance> m_performance;
};
TEST_F(LocalFrameTest, nodeImage) {
@@ -138,4 +148,14 @@ TEST_F(LocalFrameTest, dragImageForSelectionUsesPageScaleFactor) {
EXPECT_EQ(image1->size().height() * 2, image2->size().height());
}
+TEST_F(LocalFrameTest, LongTaskObserverInstrumentation) {
+ EXPECT_FALSE(hasWebPerformanceAgent());
+ frame().enableInspectorWebPerfAgent(performance());
+ EXPECT_TRUE(hasWebPerformanceAgent());
+ EXPECT_TRUE(hasWebPerformanceAgentObservers());
+
+ frame().disableInspectorWebPerfAgent(performance());
+ EXPECT_FALSE(hasWebPerformanceAgent());
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698