Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / extensions / test / data / system / storage_eject / test.js
blobb56ae1e968bcbb73fd755c6f2d5d36cf5bc7c931
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.
5 var attachedDeviceId;
7 function testAttach(details) {
8 attachedDeviceId = details.id;
9 chrome.test.sendMessage('attach_test_ok,' + details.name);
12 function ejectCallback(result) {
13 if (result == "success") {
14 chrome.test.sendMessage("eject_ok");
15 } else if (result == "in_use") {
16 chrome.test.sendMessage("eject_in_use");
17 } else if (result == "no_such_device") {
18 chrome.test.sendMessage("eject_no_such_device");
19 } else {
20 chrome.test.sendMessage("eject_failure");
24 function ejectTest() {
25 chrome.system.storage.ejectDevice(attachedDeviceId, ejectCallback);
28 function addAttachListener() {
29 chrome.system.storage.onAttached.addListener(testAttach);
30 chrome.test.sendMessage('add_attach_ok');
33 function removeAttachListener() {
34 chrome.system.storage.onAttached.removeListener(testAttach);
35 chrome.test.sendMessage('remove_attach_ok');
38 function ejectFailTest() {
39 chrome.system.storage.ejectDevice('-1', ejectCallback);
42 chrome.test.sendMessage('loaded');