Commit ff78c470 authored by Stephen McGruer's avatar Stephen McGruer Committed by Commit Bot

Remove promise_rejects in bluetooth/ and clipboard/

Replaced with promise_rejects_js and promise_rejects_dom.

Bug: 1051932
Change-Id: I7a7b213a58dfb15eb2dea1325f904ea68e25e18b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2116192Reviewed-by: default avatarLuke Z <lpz@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752792}
parent a246d919
...@@ -93,7 +93,7 @@ bluetooth_test(t => { ...@@ -93,7 +93,7 @@ bluetooth_test(t => {
let test_promises = Promise.resolve(); let test_promises = Promise.resolve();
test_specs.forEach(args => { test_specs.forEach(args => {
test_promises = test_promises.then( test_promises = test_promises.then(
() => promise_rejects( () => promise_rejects_dom(
t, 'NotFoundError', requestDeviceWithTrustedClick(args))); t, 'NotFoundError', requestDeviceWithTrustedClick(args)));
}); });
return test_promises; return test_promises;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
bluetooth_test(t => { bluetooth_test(t => {
return setBluetoothFakeAdapter('EmptyNameHeartRateAdapter') return setBluetoothFakeAdapter('EmptyNameHeartRateAdapter')
.then( .then(
() => promise_rejects( () => promise_rejects_dom(
t, 'NotFoundError', t, 'NotFoundError',
requestDeviceWithTrustedClick( requestDeviceWithTrustedClick(
{filters: [{namePrefix: 'a', services: ['heart_rate']}]}))); {filters: [{namePrefix: 'a', services: ['heart_rate']}]})));
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
bluetooth_test(t => { bluetooth_test(t => {
return setBluetoothFakeAdapter('EmptyNameHeartRateAdapter') return setBluetoothFakeAdapter('EmptyNameHeartRateAdapter')
.then( .then(
() => promise_rejects( () => promise_rejects_dom(
t, 'NotFoundError', t, 'NotFoundError',
requestDeviceWithTrustedClick( requestDeviceWithTrustedClick(
{filters: [{name: 'a', services: ['heart_rate']}]}))); {filters: [{name: 'a', services: ['heart_rate']}]})));
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
bluetooth_test(t => { bluetooth_test(t => {
return setBluetoothFakeAdapter('HeartRateAdapter') return setBluetoothFakeAdapter('HeartRateAdapter')
.then( .then(
() => promise_rejects( () => promise_rejects_dom(
t, 'NotFoundError', t, 'NotFoundError',
requestDeviceWithTrustedClick( requestDeviceWithTrustedClick(
{filters: [{name: '', services: ['heart_rate']}]}))); {filters: [{name: '', services: ['heart_rate']}]})));
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
bluetooth_test(t => { bluetooth_test(t => {
return setBluetoothFakeAdapter('NoNameHeartRateAdapter') return setBluetoothFakeAdapter('NoNameHeartRateAdapter')
.then( .then(
() => promise_rejects( () => promise_rejects_dom(
t, 'NotFoundError', t, 'NotFoundError',
requestDeviceWithTrustedClick( requestDeviceWithTrustedClick(
{filters: [{name: '', services: ['heart_rate']}]}))); {filters: [{name: '', services: ['heart_rate']}]})));
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
bluetooth_test(t => { bluetooth_test(t => {
return setBluetoothFakeAdapter('NoNameHeartRateAdapter') return setBluetoothFakeAdapter('NoNameHeartRateAdapter')
.then( .then(
() => promise_rejects( () => promise_rejects_dom(
t, 'NotFoundError', t, 'NotFoundError',
requestDeviceWithTrustedClick( requestDeviceWithTrustedClick(
{filters: [{namePrefix: 'a', services: ['heart_rate']}]}))); {filters: [{namePrefix: 'a', services: ['heart_rate']}]})));
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
bluetooth_test(t => { bluetooth_test(t => {
return setBluetoothFakeAdapter('NoNameHeartRateAdapter') return setBluetoothFakeAdapter('NoNameHeartRateAdapter')
.then( .then(
() => promise_rejects( () => promise_rejects_dom(
t, 'NotFoundError', t, 'NotFoundError',
requestDeviceWithTrustedClick( requestDeviceWithTrustedClick(
{filters: [{name: 'a', services: ['heart_rate']}]}))); {filters: [{name: 'a', services: ['heart_rate']}]})));
......
...@@ -13,7 +13,7 @@ bluetooth_test(t => { ...@@ -13,7 +13,7 @@ bluetooth_test(t => {
// service. // service.
return setBluetoothFakeAdapter('GlucoseHeartRateAdapter') return setBluetoothFakeAdapter('GlucoseHeartRateAdapter')
.then( .then(
() => promise_rejects( () => promise_rejects_dom(
t, 'NotFoundError', t, 'NotFoundError',
requestDeviceWithTrustedClick( requestDeviceWithTrustedClick(
{filters: [{services: ['heart_rate', 'battery_service']}]}))); {filters: [{services: ['heart_rate', 'battery_service']}]})));
......
...@@ -11,7 +11,7 @@ bluetooth_test(t => { ...@@ -11,7 +11,7 @@ bluetooth_test(t => {
.then(() => requestDeviceWithTrustedClick({ .then(() => requestDeviceWithTrustedClick({
filters: [{services: [errorUUID(0x1) /* in progress error */]}]})) filters: [{services: [errorUUID(0x1) /* in progress error */]}]}))
.then(device => { .then(device => {
promise_rejects(t, 'NetworkError', device.gatt.connect()); promise_rejects_dom(t, 'NetworkError', device.gatt.connect());
}) })
.then(runGarbageCollection); .then(runGarbageCollection);
}, 'Garbage collection ran during a connect call that fails. ' + }, 'Garbage collection ran during a connect call that fails. ' +
......
...@@ -35,30 +35,30 @@ promise_test(async t => { ...@@ -35,30 +35,30 @@ promise_test(async t => {
const item1 = new ClipboardItem({'text/plain': blob1}); const item1 = new ClipboardItem({'text/plain': blob1});
const item2 = new ClipboardItem({'text/plain': blob2}); const item2 = new ClipboardItem({'text/plain': blob2});
await promise_rejects(t, "NotAllowedError", await promise_rejects_dom(t, "NotAllowedError",
navigator.clipboard.write([item1, item2])); navigator.clipboard.write([item1, item2]));
}, 'navigator.clipboard.write([>1 ClipboardItems]) fails (not implemented)'); }, 'navigator.clipboard.write([>1 ClipboardItems]) fails (not implemented)');
promise_test(async t => { promise_test(async t => {
await getPermissions(); await getPermissions();
await promise_rejects(t, new TypeError(), navigator.clipboard.write()); await promise_rejects_js(t, TypeError, navigator.clipboard.write());
}, 'navigator.clipboard.write() fails (expect [ClipboardItem])'); }, 'navigator.clipboard.write() fails (expect [ClipboardItem])');
promise_test(async t => { promise_test(async t => {
await getPermissions(); await getPermissions();
await promise_rejects(t, new TypeError(), navigator.clipboard.write(null)); await promise_rejects_js(t, TypeError, navigator.clipboard.write(null));
}, 'navigator.clipboard.write(null) fails (expect [ClipboardItem])'); }, 'navigator.clipboard.write(null) fails (expect [ClipboardItem])');
promise_test(async t => { promise_test(async t => {
await getPermissions(); await getPermissions();
await promise_rejects(t, new TypeError(), await promise_rejects_js(t, TypeError,
navigator.clipboard.write('Bad string')); navigator.clipboard.write('Bad string'));
}, 'navigator.clipboard.write(DOMString) fails (expect [ClipboardItem])'); }, 'navigator.clipboard.write(DOMString) fails (expect [ClipboardItem])');
promise_test(async t => { promise_test(async t => {
await getPermissions(); await getPermissions();
const blob = new Blob(['hello'], {type: 'text/plain'}); const blob = new Blob(['hello'], {type: 'text/plain'});
await promise_rejects(t, new TypeError(), navigator.clipboard.write(blob)); await promise_rejects_js(t, TypeError, navigator.clipboard.write(blob));
}, 'navigator.clipboard.write(Blob) fails (expect [ClipboardItem])'); }, 'navigator.clipboard.write(Blob) fails (expect [ClipboardItem])');
promise_test(async () => { promise_test(async () => {
...@@ -68,8 +68,8 @@ promise_test(async () => { ...@@ -68,8 +68,8 @@ promise_test(async () => {
promise_test(async t => { promise_test(async t => {
await getPermissions(); await getPermissions();
await promise_rejects(t, new TypeError(), await promise_rejects_js(t, TypeError,
navigator.clipboard.writeText()); navigator.clipboard.writeText());
}, 'navigator.clipboard.writeText() fails (expect DOMString)'); }, 'navigator.clipboard.writeText() fails (expect DOMString)');
promise_test(async () => { promise_test(async () => {
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
<script> <script>
promise_test(async t => { promise_test(async t => {
await PermissionsHelper.setPermission('clipboard-read-write', 'denied'); await PermissionsHelper.setPermission('clipboard-read-write', 'denied');
await promise_rejects(t, 'NotAllowedError', navigator.clipboard.readText()); await promise_rejects_dom(t, 'NotAllowedError', navigator.clipboard.readText());
}, 'navigator.clipboard.readText() fails when permission denied'); }, 'navigator.clipboard.readText() fails when permission denied');
</script> </script>
\ No newline at end of file
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
<script> <script>
promise_test(async t => { promise_test(async t => {
await PermissionsHelper.setPermission('clipboard-sanitized-write', 'denied'); await PermissionsHelper.setPermission('clipboard-sanitized-write', 'denied');
await promise_rejects(t, 'NotAllowedError', navigator.clipboard.writeText('xyz')); await promise_rejects_dom(t, 'NotAllowedError', navigator.clipboard.writeText('xyz'));
}, 'navigator.clipboard.writeText() fails when permission denied'); }, 'navigator.clipboard.writeText() fails when permission denied');
</script> </script>
\ No newline at end of file
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