Commit cbb1d5b8 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Fix (again) the declarative Shadow DOM perf test

The [1] CL again changed the opt-in interface for declarative
Shadow DOM, and I forgot to update the perf test. This CL makes
that update. I wish there were perf bots in the CQ.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/2530222

Bug: 1042130
Fixed: 1148583
Change-Id: Icee204fd4fecc2926dbe50ab7c08b36643d11c4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536451Reviewed-by: default avatarJoey Arhar <jarhar@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827188}
parent 80dee2b3
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
<script src="../resources/runner.js"></script> <script src="../resources/runner.js"></script>
<script> <script>
const hostChildren = 100;
function createDeepShadowTemplateContent(levels, slotted) { function createDeepShadowTemplateContent(levels, slotted) {
const nestedContent = levels > 0 ? createDeepShadowTemplateContent(levels-1) : '<span>End</span>'; const nestedContent = levels > 0 ? createDeepShadowTemplateContent(levels-1) : '<span>End</span>';
if (slotted) { if (slotted) {
...@@ -15,16 +13,19 @@ function createDeepShadowTemplateContent(levels, slotted) { ...@@ -15,16 +13,19 @@ function createDeepShadowTemplateContent(levels, slotted) {
} }
} }
const hostChildren = 100;
function buildTemplate(slotted) {
const template = document.createElement('template');
document.body.appendChild(template);
const html = createDeepShadowTemplateContent(hostChildren, slotted);
template.setInnerHTML(html, {allowShadowRoot: true});
return template;
}
// Build templates once // Build templates once
const templateSlotted = document.createElement('template'); const templateSlotted = buildTemplate(true);
document.body.appendChild(templateSlotted); const templateNested = buildTemplate(false);
templateSlotted.content.allowDeclarativeShadowDom = true;
templateSlotted.innerHTML = createDeepShadowTemplateContent(hostChildren, true);
const templateNested = document.createElement('template');
document.body.appendChild(templateNested);
templateNested.content.allowDeclarativeShadowDom = true;
templateNested.innerHTML = createDeepShadowTemplateContent(hostChildren, false);
if (!templateSlotted.content.firstChild.shadowRoot) { if (!templateSlotted.content.firstChild.shadowRoot) {
PerfTestRunner.logFatalError("Declarative Shadow DOM must be enabled for this test."); PerfTestRunner.logFatalError("Declarative Shadow DOM must be enabled for this test.");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment