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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorWebPerfAgentTest.cpp

Issue 2345023002: Revert of Track frame context URL using first script heuristic (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorWebPerfAgent.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
deleted file mode 100644
index 7b809715adb1f2eeba84bb012bee0b897ea178b2..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/inspector/InspectorWebPerfAgentTest.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "core/inspector/InspectorWebPerfAgent.h"
-
-#include "core/frame/Location.h"
-#include "core/inspector/InspectedFrames.h"
-#include "core/testing/DummyPageHolder.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "wtf/PtrUtil.h"
-
-#include <memory>
-
-namespace blink {
-
-class InspectorWebPerfAgentTest : public ::testing::Test {
-protected:
- void SetUp() override;
- LocalFrame* frame() const { return m_pageHolder->document().frame(); }
- ExecutionContext* executionContext() const { return &m_pageHolder->document(); }
- ExecutionContext* anotherExecutionContext() const { return &m_anotherPageHolder->document(); }
-
- String frameContextURL();
- int numUniqueFrameContextsSeen();
-
- Persistent<InspectorWebPerfAgent> m_agent;
- std::unique_ptr<DummyPageHolder> m_pageHolder;
- std::unique_ptr<DummyPageHolder> m_anotherPageHolder;
-};
-
-void InspectorWebPerfAgentTest::SetUp()
-{
- m_pageHolder = DummyPageHolder::create(IntSize(800, 600));
- m_pageHolder->document().setURL(KURL(KURL(), "https://example.com/foo"));
- m_agent = new InspectorWebPerfAgent(InspectedFrames::create(frame()));
-
- // Create another dummy page holder and pretend this is the iframe.
- m_anotherPageHolder = DummyPageHolder::create(IntSize(400, 300));
- m_anotherPageHolder->document().setURL(KURL(KURL(), "https://iframed.com/bar"));
-}
-
-String InspectorWebPerfAgentTest::frameContextURL()
-{
- // This is reported only if there is a single frameContext URL.
- if (m_agent->m_frameContextLocations.size() != 1)
- return "";
- for (Member<Location> location : m_agent->m_frameContextLocations) {
- return String(location->protocol()) + "//"
- + location->hostname() + location->pathname();
- }
- return "";
-}
-
-int InspectorWebPerfAgentTest::numUniqueFrameContextsSeen()
-{
- return m_agent->m_frameContextLocations.size();
-}
-
-TEST_F(InspectorWebPerfAgentTest, SingleScriptInTask)
-{
- m_agent->willProcessTask();
- EXPECT_EQ(0, numUniqueFrameContextsSeen());
- m_agent->willExecuteScript(executionContext());
- EXPECT_EQ(1, numUniqueFrameContextsSeen());
- m_agent->didExecuteScript();
- m_agent->didProcessTask();
- m_agent->ReportTaskTime(3719349.445172, 3719349.5561923); // Long task
- EXPECT_EQ(1, numUniqueFrameContextsSeen());
- EXPECT_EQ("https://example.com/foo", frameContextURL());
-}
-
-TEST_F(InspectorWebPerfAgentTest, MultipleScriptsInTask_SingleContext)
-{
- m_agent->willProcessTask();
- EXPECT_EQ(0, numUniqueFrameContextsSeen());
- m_agent->willExecuteScript(executionContext());
- EXPECT_EQ(1, numUniqueFrameContextsSeen());
- m_agent->didExecuteScript();
- EXPECT_EQ("https://example.com/foo", frameContextURL());
-
- m_agent->willExecuteScript(executionContext());
- EXPECT_EQ(1, numUniqueFrameContextsSeen());
- m_agent->didExecuteScript();
- m_agent->didProcessTask();
- m_agent->ReportTaskTime(3719349.445172, 3719349.5561923); // Long task
- EXPECT_EQ(1, numUniqueFrameContextsSeen());
- EXPECT_EQ("https://example.com/foo", frameContextURL());
-}
-
-TEST_F(InspectorWebPerfAgentTest, MultipleScriptsInTask_MultipleContexts)
-{
- m_agent->willProcessTask();
- EXPECT_EQ(0, numUniqueFrameContextsSeen());
- m_agent->willExecuteScript(executionContext());
- EXPECT_EQ(1, numUniqueFrameContextsSeen());
- m_agent->didExecuteScript();
- EXPECT_EQ("https://example.com/foo", frameContextURL());
-
- m_agent->willExecuteScript(anotherExecutionContext());
- EXPECT_EQ(2, numUniqueFrameContextsSeen());
- m_agent->didExecuteScript();
- m_agent->didProcessTask();
- m_agent->ReportTaskTime(3719349.445172, 3719349.5561923); // Long task
- EXPECT_EQ(2, numUniqueFrameContextsSeen());
- EXPECT_EQ("", frameContextURL());
-}
-
-TEST_F(InspectorWebPerfAgentTest, NoScriptInLongTask)
-{
- m_agent->willProcessTask();
- m_agent->willExecuteScript(executionContext());
- m_agent->didExecuteScript();
- m_agent->didProcessTask();
- m_agent->ReportTaskTime(3719349.445172, 3719349.445182);
- m_agent->willProcessTask();
- m_agent->didProcessTask();
- m_agent->ReportTaskTime(3719349.445172, 3719349.5561923); // Long task
- // Without presence of Script, FrameContext URL is not available
- EXPECT_EQ(0, numUniqueFrameContextsSeen());
-}
-
-} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorWebPerfAgent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698