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

Unified Diff: chrome/test/data/extensions/api_test/image_writer_private/list_devices/test.js

Issue 266363006: Adds API tests for listRemovableStorageDevices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/image_writer_private/list_devices/manifest.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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])
« no previous file with comments | « chrome/test/data/extensions/api_test/image_writer_private/list_devices/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698