Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1887)

Side by Side Diff: chrome/test/data/extensions/api_test/system/storage_eject/test.js

Issue 18578008: [SystemInfo API] Move Storage API out of experimental namespace and rename to the "system" namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix PermissionTest unittest. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var attachedDeviceId; 5 var attachedDeviceId;
6 6
7 systemInfo = chrome.experimental.systemInfo;
8
9 function testAttach(details) { 7 function testAttach(details) {
10 attachedDeviceId = details.id; 8 attachedDeviceId = details.id;
11 chrome.test.sendMessage('attach_test_ok,' + details.name); 9 chrome.test.sendMessage('attach_test_ok,' + details.name);
12 }; 10 };
13 11
14 function ejectCallback(result) { 12 function ejectCallback(result) {
15 if (result == "success") { 13 if (result == "success") {
16 chrome.test.sendMessage("eject_ok"); 14 chrome.test.sendMessage("eject_ok");
17 } else if (result == "in_use") { 15 } else if (result == "in_use") {
18 chrome.test.sendMessage("eject_in_use"); 16 chrome.test.sendMessage("eject_in_use");
19 } else if (result == "no_such_device") { 17 } else if (result == "no_such_device") {
20 chrome.test.sendMessage("eject_no_such_device"); 18 chrome.test.sendMessage("eject_no_such_device");
21 } else { 19 } else {
22 chrome.test.sendMessage("eject_failure"); 20 chrome.test.sendMessage("eject_failure");
23 } 21 }
24 }; 22 };
25 23
26 function ejectTest() { 24 function ejectTest() {
27 systemInfo.storage.ejectDevice(attachedDeviceId, ejectCallback); 25 chrome.system.storage.ejectDevice(attachedDeviceId, ejectCallback);
28 }; 26 };
29 27
30 function addAttachListener() { 28 function addAttachListener() {
31 systemInfo.storage.onAttached.addListener(testAttach); 29 chrome.system.storage.onAttached.addListener(testAttach);
32 chrome.test.sendMessage('add_attach_ok'); 30 chrome.test.sendMessage('add_attach_ok');
33 }; 31 };
34 32
35 function removeAttachListener() { 33 function removeAttachListener() {
36 systemInfo.storage.onAttached.removeListener(testAttach); 34 chrome.system.storage.onAttached.removeListener(testAttach);
37 chrome.test.sendMessage('remove_attach_ok'); 35 chrome.test.sendMessage('remove_attach_ok');
38 }; 36 };
39 37
40 function ejectFailTest() { 38 function ejectFailTest() {
41 systemInfo.storage.ejectDevice('-1', ejectCallback); 39 chrome.system.storage.ejectDevice('-1', ejectCallback);
42 }; 40 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698