Chromium Code Reviews| 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..20687a96fe9d9862e0a4d60e56f219afb2585d2c |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/api_test/image_writer_private/list_devices/test.js |
| @@ -0,0 +1,45 @@ |
| +// 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(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; |
| + }); |
| + |
| + if (deviceList.length == 2) { |
| + 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.succeed(); |
| + return; |
| + } |
| + |
| + chrome.test.fail(); |
| +} |
| + |
| +chrome.test.runTests([testDeviceList]) |
|
asargent_no_longer_on_chrome
2014/05/07 21:31:40
FYI, I think your test is in danger of completing
Drew Haven
2014/05/08 00:14:34
Yeah, I had trouble understanding the framework an
|