Index: chrome/test/data/extensions/api_test/image_writer_private/list_devices/test.js |
diff --git a/chrome/test/data/extensions/api_test/image_writer_private/list_devices/test.js b/chrome/test/data/extensions/api_test/image_writer_private/list_devices/test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5643515dbb0378a280c486b85ed44485e4c8f3f1 |
--- /dev/null |
+++ b/chrome/test/data/extensions/api_test/image_writer_private/list_devices/test.js |
@@ -0,0 +1,41 @@ |
+// 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. |
+ |
+var expectedDevices = [{ |
+ 'vendor': 'Vendor 1', |
+ 'model': 'Model 1', |
+ 'capacity': 1 << 20, |
+ 'storageUnitId': '/test/id/1', |
+ }, { |
+ 'vendor': 'Vendor 2', |
+ 'model': 'Model 2', |
+ 'capacity': 1 << 22, |
+ 'storageUnitId': '/test/id/2', |
+ }]; |
+ |
+ |
+function testDeviceList() { |
+ chrome.imageWriterPrivate.listRemovableStorageDevices( |
+ chrome.test.callback(listRemovableDevicesCallback)); |
+} |
+ |
+function listRemovableDevicesCallback(deviceList) { |
+ deviceList.sort(function (a, b) { |
+ if (a.storageUnitId > b.storageUnitId) return 1; |
+ if (a.storageUnitId < b.storageUnitId) return -1; |
+ return 0; |
+ }); |
+ |
+ chrome.test.assertEq(2, deviceList.length); |
+ |
+ deviceList.forEach(function (dev, i) { |
+ var expected = expectedDevices[i]; |
+ chrome.test.assertEq(expected.vendor, dev.vendor); |
+ chrome.test.assertEq(expected.model, dev.model); |
+ chrome.test.assertEq(expected.capacity, dev.capacity); |
+ chrome.test.assertEq(expected.storageUnitId, dev.storageUnitId); |
+ }); |
+} |
+ |
+chrome.test.runTests([testDeviceList]) |