| Index: chrome/test/data/extensions/api_test/bluetooth_low_energy/read_descriptor_value/runtest.js
|
| diff --git a/chrome/test/data/extensions/api_test/bluetooth_low_energy/read_descriptor_value/runtest.js b/chrome/test/data/extensions/api_test/bluetooth_low_energy/read_descriptor_value/runtest.js
|
| index e7693a96ae9fdf73eba67784d0d48c62f885a8fd..550052023a478531e5fd54ba4e4093bf3539a53c 100644
|
| --- a/chrome/test/data/extensions/api_test/bluetooth_low_energy/read_descriptor_value/runtest.js
|
| +++ b/chrome/test/data/extensions/api_test/bluetooth_low_energy/read_descriptor_value/runtest.js
|
| @@ -2,7 +2,13 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +var error;
|
| +
|
| function testReadDescriptorValue() {
|
| + if (error !== undefined) {
|
| + chrome.test.sendMessage('fail');
|
| + chrome.test.fail(error);
|
| + }
|
| chrome.test.assertTrue(descriptor != null, '\'descriptor\' is null');
|
| chrome.test.assertEq(descId, descriptor.instanceId);
|
|
|
| @@ -15,22 +21,30 @@ var badDescId = 'desc_id1';
|
|
|
| var descriptor = null;
|
|
|
| +function earlyError(message) {
|
| + error = message;
|
| + chrome.test.runTests([testReadDescriptorValue]);
|
| +}
|
| +
|
| // 1. Unknown descriptor instanceId.
|
| readDescriptorValue(badDescId, function (result) {
|
| if (result || !chrome.runtime.lastError) {
|
| - chrome.test.fail('\'badDescId\' did not cause failure');
|
| + earlyError('\'badDescId\' did not cause failure');
|
| + return;
|
| }
|
|
|
| // 2. Known descriptor instanceId, but call failure.
|
| readDescriptorValue(descId, function (result) {
|
| if (result || !chrome.runtime.lastError) {
|
| - chrome.test.fail('readDescriptorValue should have failed');
|
| + earlyError('readDescriptorValue should have failed');
|
| + return;
|
| }
|
|
|
| // 3. Call should succeed.
|
| readDescriptorValue(descId, function (result) {
|
| if (chrome.runtime.lastError) {
|
| - chrome.test.fail(chrome.runtime.lastError.message);
|
| + earlyError(chrome.runtime.lastError.message);
|
| + return;
|
| }
|
|
|
| descriptor = result;
|
|
|