
This flag is obsolete Bug: 373263977 Change-Id: Ibcdf3b84ce33f40ab8ddb8e73f8dd2dc5fc2440a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6098249 Reviewed-by: Dominic Farolino <dom@chromium.org> Commit-Queue: Noam Rosenthal <nrosenthal@chromium.org> Reviewed-by: Annie Sullivan <sullivan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1396746}
64 lines
2.1 KiB
C++
64 lines
2.1 KiB
C++
// Copyright 2022 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "base/command_line.h"
|
|
#include "base/feature_list.h"
|
|
#include "base/test/scoped_feature_list.h"
|
|
#include "cc/base/features.h"
|
|
#include "content/browser/web_contents/web_contents_impl.h"
|
|
#include "content/public/common/content_switches.h"
|
|
#include "content/public/test/browser_test.h"
|
|
#include "content/public/test/browser_test_utils.h"
|
|
#include "content/public/test/content_browser_test.h"
|
|
#include "content/public/test/content_browser_test_utils.h"
|
|
#include "content/shell/browser/shell.h"
|
|
#include "content/test/content_browser_test_utils_internal.h"
|
|
#include "net/dns/mock_host_resolver.h"
|
|
|
|
namespace content {
|
|
class LargestContentfulPaintTestBrowserTest
|
|
: public ContentBrowserTest,
|
|
public ::testing::WithParamInterface<bool> {
|
|
protected:
|
|
void SetUpOnMainThread() override {
|
|
host_resolver()->AddRule("*", "127.0.0.1");
|
|
SetupCrossSiteRedirector(embedded_test_server());
|
|
ASSERT_TRUE(embedded_test_server()->Start());
|
|
ContentBrowserTest::SetUpOnMainThread();
|
|
}
|
|
|
|
WebContentsImpl* web_contents() const {
|
|
return static_cast<WebContentsImpl*>(shell()->web_contents());
|
|
}
|
|
|
|
RenderFrameHostImpl* current_frame_host() {
|
|
return web_contents()->GetPrimaryFrameTree().root()->current_frame_host();
|
|
}
|
|
|
|
EvalJsResult GetStartTime(std::string type) const {
|
|
std::string script = content::JsReplace("getStartTime($1);", type);
|
|
return EvalJs(shell(), script);
|
|
}
|
|
|
|
private:
|
|
base::test::ScopedFeatureList features_;
|
|
};
|
|
|
|
IN_PROC_BROWSER_TEST_F(LargestContentfulPaintTestBrowserTest,
|
|
NonTAOImageLCPRenderTime) {
|
|
const GURL url1(embedded_test_server()->GetURL(
|
|
"a.com", "/performance_timeline/cross-origin-non-tao-image.html"));
|
|
|
|
EXPECT_TRUE(NavigateToURL(shell(), url1));
|
|
|
|
double fcpStartTime = GetStartTime("paint").ExtractDouble();
|
|
|
|
double lcpStartTime =
|
|
GetStartTime("largest-contentful-paint").ExtractDouble();
|
|
|
|
EXPECT_NEAR(lcpStartTime, fcpStartTime, 0.01);
|
|
}
|
|
|
|
} // namespace content
|