chromium/chrome/test/data/permissions/killswitch_tester.html

<!DOCTYPE html>
<html>
<!--killswitch_tester.html
Script with javascript functions for requesting notification and geolocation
permissions.
-->
<script>
function requestGeolocation() {
  return new Promise(resolve => navigator.geolocation.getCurrentPosition(function(){}, resolve))
    .then(geoErrorCallback);
}

function requestNotification() {
  return new Promise(resolve => Notification.requestPermission(resolve))
    .then(sendResultToTest);
}

function geoErrorCallback(error) {
  switch(error.code) {
    case error.PERMISSION_DENIED:
      return sendResultToTest("denied");
      break;
    default:
      return sendResultToTest(error.code);
  }
}

// Sends a result back to the main test logic.
function sendResultToTest(result) {
  // Convert the result to a string.
  var stringResult = "" + result;
  if (typeof stringResult != "string")
    stringResult = JSON.stringify(result);
  return stringResult;
}
</script>
<body>
</body>
</html>