Commit 98ad6f88 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Simplify Web Components v0 policy test

The prior test checked for deprecation messages, which is quite
roundabout. This just feature-detects all three features.

Change-Id: I7e034061b0c041b6341ec9eae9a5e3ab3b643c78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1900917
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713222}
parent 4e2f70a7
...@@ -35,21 +35,14 @@ IN_PROC_BROWSER_TEST_F(WebComponentsV0Test, CheckWebComponentsV0Enabled) { ...@@ -35,21 +35,14 @@ IN_PROC_BROWSER_TEST_F(WebComponentsV0Test, CheckWebComponentsV0Enabled) {
ui_test_utils::NavigateToURL(browser(), url); ui_test_utils::NavigateToURL(browser(), url);
constexpr char kScript[] = constexpr char kScript[] =
R"({ R"({
let link = document.createElement('link'); const htmlImportsEnabled = 'import' in
link.setAttribute('rel','import'); document.createElement('link');
let div = document.createElement('div'); const customElementsV0Enabled = 'registerElement' in document;
try { div.createShadowRoot(); } catch {} const shadowDomV0Enabled = 'createShadowRoot' in
try { document.registerElement('test-element'); } catch {} document.createElement('div');
const observer = new ReportingObserver((reports, observer) => { const allEnabled = htmlImportsEnabled && customElementsV0Enabled
var needed = ['HTMLImports','ElementCreateShadowRoot', && shadowDomV0Enabled;
'DocumentRegisterElement'];
for (const report of reports) {
needed = needed.filter(item => item !== report.body.id);
}
var allEnabled = needed.length == 0;
window.domAutomationController.send(allEnabled); window.domAutomationController.send(allEnabled);
}, {types: ['deprecation'], buffered: true});
observer.observe();
})"; })";
content::WebContents* web_contents = content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
......
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