1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 chrome.bluetoothLowEnergy.onServiceAdded.addListener(function (result) {
6 // getService should return this service.
7 chrome.bluetoothLowEnergy.getService(result.instanceId, function (service) {
8 if (chrome.runtime.lastError) {
9 chrome.test.sendMessage(chrome.runtime.lastError.message);
12 chrome.test.assertEq(result.instanceId, service.instanceId);
14 chrome.test.sendMessage('getServiceSuccess');
18 chrome.bluetoothLowEnergy.onServiceRemoved.addListener(function (result) {
19 // getService should return error.
20 chrome.bluetoothLowEnergy.getService(result.instanceId, function (service) {
21 if (service || !chrome.runtime.lastError) {
22 chrome.test.sendMessage('Call to getService should have failed.');
25 chrome.test.sendMessage('getServiceFail', function (message) {
26 chrome.test.succeed();