chromium/third_party/blink/web_tests/external/wpt/permissions-policy/resources/permissions-policy-battery.html

<script>
'use strict';

Promise.resolve().then(() => navigator.getBattery()).then(battery => {
  window.parent.postMessage({ type: 'availability-result', enabled: true }, '*');
}, error => {
  window.parent.postMessage({ type: 'availability-result', enabled: false }, '*');
});
</script>