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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e7693a96ae9fdf73eba67784d0d48c62f885a8fd |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/bluetooth_low_energy/read_descriptor_value/runtest.js |
@@ -0,0 +1,43 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+function testReadDescriptorValue() { |
+ chrome.test.assertTrue(descriptor != null, '\'descriptor\' is null'); |
+ chrome.test.assertEq(descId, descriptor.instanceId); |
+ |
+ chrome.test.succeed(); |
+} |
+ |
+var readDescriptorValue = chrome.bluetoothLowEnergy.readDescriptorValue; |
+var descId = 'desc_id0'; |
+var badDescId = 'desc_id1'; |
+ |
+var descriptor = null; |
+ |
+// 1. Unknown descriptor instanceId. |
+readDescriptorValue(badDescId, function (result) { |
+ if (result || !chrome.runtime.lastError) { |
+ chrome.test.fail('\'badDescId\' did not cause failure'); |
+ } |
+ |
+ // 2. Known descriptor instanceId, but call failure. |
+ readDescriptorValue(descId, function (result) { |
+ if (result || !chrome.runtime.lastError) { |
+ chrome.test.fail('readDescriptorValue should have failed'); |
+ } |
+ |
+ // 3. Call should succeed. |
+ readDescriptorValue(descId, function (result) { |
+ if (chrome.runtime.lastError) { |
+ chrome.test.fail(chrome.runtime.lastError.message); |
+ } |
+ |
+ descriptor = result; |
+ |
+ chrome.test.sendMessage('ready', function (message) { |
+ chrome.test.runTests([testReadDescriptorValue]); |
+ }); |
+ }); |
+ }); |
+}); |