blob: 38bc2065b19655050c545ae640712dc07a87580b [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>getCost with invalid argument fails from a Service Worker</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../serviceworker/resources/test-helpers.js"></script>
<script src="../notifications/resources/test-helpers.js"></script>
</head>
<body>
<script>
promise_test(async function(test) {
const script = 'resources/instrumentation-service-worker.js';
const scope = 'resources/scope/' + location.pathname;
let workerInfo =
await getActiveServiceWorkerWithMessagePort(test, script, scope);
let port = workerInfo.port;
let data = await sendCommand(port, { command: 'getCostInvalidType' });
assert_equals(event.data.command, 'getCostInvalidType');
assert_false(event.data.success,
'getCost should fail with invalid arguments.');
assert_equals(event.data.errorMessage, "Failed to execute 'getCost' on 'BudgetService': The provided value 'frobinator' is not a valid enum value of type OperationType.");
}, 'getCost with invalid arugment should fail from Service Worker');
</script>
</body>
</html>