| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 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. | |
| 4 | |
| 5 var attachedDeviceId; | |
| 6 | |
| 7 systemInfo = chrome.experimental.systemInfo; | |
| 8 | |
| 9 function testAttach(details) { | |
| 10 attachedDeviceId = details.id; | |
| 11 chrome.test.sendMessage('attach_test_ok,' + details.name); | |
| 12 }; | |
| 13 | |
| 14 function ejectCallback(result) { | |
| 15 if (result == "success") { | |
| 16 chrome.test.sendMessage("eject_ok"); | |
| 17 } else if (result == "in_use") { | |
| 18 chrome.test.sendMessage("eject_in_use"); | |
| 19 } else if (result == "no_such_device") { | |
| 20 chrome.test.sendMessage("eject_no_such_device"); | |
| 21 } else { | |
| 22 chrome.test.sendMessage("eject_failure"); | |
| 23 } | |
| 24 }; | |
| 25 | |
| 26 function ejectTest() { | |
| 27 systemInfo.storage.ejectDevice(attachedDeviceId, ejectCallback); | |
| 28 }; | |
| 29 | |
| 30 function addAttachListener() { | |
| 31 systemInfo.storage.onAttached.addListener(testAttach); | |
| 32 chrome.test.sendMessage('add_attach_ok'); | |
| 33 }; | |
| 34 | |
| 35 function removeAttachListener() { | |
| 36 systemInfo.storage.onAttached.removeListener(testAttach); | |
| 37 chrome.test.sendMessage('remove_attach_ok'); | |
| 38 }; | |
| 39 | |
| 40 function ejectFailTest() { | |
| 41 systemInfo.storage.ejectDevice('-1', ejectCallback); | |
| 42 }; | |
| OLD | NEW |