0
Files
src/content/test/render_document_feature.cc
Rakina Zata Amni 12a579bc7b Add a new 'non-local-root' level for RenderDocument
We planned to experiment with subframe RenderDocument in M117 as
almost all of the test failures have been fixed, but currently there
are still two problems: DevTools provisional probe sinks on local
roots, and RenderWidgetHost not being reused causing performance
regressions.

Since both of those problems only happen on navigations on local
roots, this CL adds a new "non-local-root" level for RenderDocument,
where we will only swap RenderFrameHosts on same-site navigations that
happen on non-local-root frames, which won't trigger the problems
mentioned above.

Note that adding this level won't increase the number of tests being
run on CQ. We do parameterize some navigation tests with the
RenderDocument feature, but we only have 2 levels tested:
kCrashedFrame (only same-site navigations from crashed frame will
change RFH) and kAllFrames (all same-site cross-document navigations
will change RFH, except from initial empty documents).

Bug: 936696
Change-Id: Id420fc43f6134cc83ff48e56259ef280c13471d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4753272
Owners-Override: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Fergal Daly <fergal@chromium.org>
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1180701}
2023-08-08 05:57:54 +00:00

49 lines
1.5 KiB
C++

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/test/render_document_feature.h"
#include "base/test/scoped_feature_list.h"
#include "content/common/content_navigation_policy.h"
#include "content/public/common/content_features.h"
namespace content {
void InitAndEnableRenderDocumentFeature(
base::test::ScopedFeatureList* feature_list,
std::string level) {
std::map<std::string, std::string> parameters;
parameters[kRenderDocumentLevelParameterName] = level;
feature_list->InitAndEnableFeatureWithParameters(features::kRenderDocument,
parameters);
}
std::vector<std::string> RenderDocumentFeatureLevelValues() {
// Note: We don't return kSubframe nor kNonLocalRootSubframe here as
// kAllFrames also covers subframe navigations and will affect tests that only
// do subframe navigations.
return {
GetRenderDocumentLevelName(RenderDocumentLevel::kCrashedFrame),
GetRenderDocumentLevelName(RenderDocumentLevel::kAllFrames),
};
}
std::vector<std::string> RenderDocumentFeatureFullyEnabled() {
return {
GetRenderDocumentLevelName(RenderDocumentLevel::kAllFrames),
};
}
std::string GetRenderDocumentLevelNameForTestParams(
std::string render_document_level) {
if (render_document_level ==
GetRenderDocumentLevelName(RenderDocumentLevel::kCrashedFrame)) {
return "RDCrashedFrame";
} else {
return "RDAllFrames";
}
}
} // namespace content