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

Unified Diff: chrome/test/data/extensions/api_test/system/storage/test_storage_api.js

Issue 22548009: [SystemInfo API] Implement storage.getAvailableCapacity API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@impl_get_available_capacity_api2
Patch Set: Upload again 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/system/storage/test_storage_api.js
diff --git a/chrome/test/data/extensions/api_test/system/storage/test_storage_api.js b/chrome/test/data/extensions/api_test/system/storage/test_storage_api.js
index 594f2bcf99899fdfb9d75f83506cfcb5f135aed0..8926aece48d32ac87cc8b53549b501c3c37998bc 100644
--- a/chrome/test/data/extensions/api_test/system/storage/test_storage_api.js
+++ b/chrome/test/data/extensions/api_test/system/storage/test_storage_api.js
@@ -8,13 +8,16 @@
// Testing data should be the same as |kTestingData| in
// system_storage_apitest.cc.
var testData = [
- { id:"", name: "0xbeaf", type: "removable", capacity: 4098 },
- { id:"", name: "/home", type: "fixed", capacity: 4098 },
- { id:"", name: "/data", type: "fixed", capacity: 10000 }
+ { id:"", name: "0xbeaf", type: "removable", capacity: 4098,
+ availableCapacity: 1},
+ { id:"", name: "/home", type: "fixed", capacity: 4098,
+ availableCapacity: 2},
+ { id:"", name: "/data", type: "fixed", capacity: 10000,
+ availableCapacity: 3}
];
chrome.test.runTests([
- function testGet() {
+ function testGetInfo() {
chrome.system.storage.getInfo(chrome.test.callbackPass(function(units) {
chrome.test.assertTrue(units.length == 3);
for (var i = 0; i < units.length; ++i) {
@@ -24,5 +27,23 @@ chrome.test.runTests([
chrome.test.assertEq(testData[i].capacity, units[i].capacity);
}
}));
+ },
+ function testGetAvailableCapacity() {
+ chrome.system.storage.getInfo(chrome.test.callbackPass(function(units) {
+ chrome.test.assertTrue(units.length == 3);
+ // Record all storage devices' |id| in testData.
+ for (var i = 0; i < units.length; ++i)
+ testData[i].id = units[i].id;
+ for (var i = 0; i < units.length; ++i) {
+ chrome.system.storage.getAvailableCapacity(units[i].id, function(info) {
+ for (var j = 0; j < units.length; ++j) {
+ if (info.id == testData[j].id) {
+ chrome.test.assertEq(testData[j].availableCapacity,
+ info.availableCapacity);
+ }
+ }
+ });
+ }
+ }));
}
]);

Powered by Google App Engine
This is Rietveld 408576698