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

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

Issue 15896007: [SystemInfo API] Rewrite storage info provider using storage monitor impl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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
Index: chrome/test/data/extensions/api_test/systeminfo/storage/test_storage_api.js
diff --git a/chrome/test/data/extensions/api_test/systeminfo/storage/test_storage_api.js b/chrome/test/data/extensions/api_test/systeminfo/storage/test_storage_api.js
index e400206cc18813b99dfe4763be6020098ee88c53..6aaa760e8d3aadbd62c4f38b27d434b416713110 100644
--- a/chrome/test/data/extensions/api_test/systeminfo/storage/test_storage_api.js
+++ b/chrome/test/data/extensions/api_test/systeminfo/storage/test_storage_api.js
@@ -8,12 +8,15 @@ chrome.systemInfo = chrome.experimental.systemInfo;
// Testing data should be the same as that in system_info_storage_apitest.cc
var testData = [
- { id: "0xbeaf", type: "unknown", capacity: 4098,
- availableCapacity: 1000, step: 0 },
- { id: "/home", type: "fixed", capacity: 4098,
- availableCapacity: 1000, step: 10 },
- { id: "/data", type: "fixed", capacity: 10000,
- availableCapacity: 1000, step: 4097 }
+ { id: "mtp:device:001", name: "name:001", location: "location:/cache",
+ vendorName: "vendor:001", modelName: "model:001", type: "unknown",
+ capacity: 4098, availableCapacity: 1000, step: 0 },
+ { id: "path:device:002", name: "name:002", location: "location:/home",
+ vendorName: "vendor:002", modelName: "model:002", type: "fixed",
+ capacity: 4098, availableCapacity: 1000, step: 10 },
+ { id: "path:device:003", name: "name:003", location: "location:C:\\",
+ vendorName: "vendor:003", modelName: "model:003", type: "fixed",
+ capacity: 10000, availableCapacity: 1000, step: 4097 }
];
chrome.test.runTests([
@@ -22,11 +25,17 @@ chrome.test.runTests([
chrome.test.assertTrue(units.length == 3);
for (var i = 0; i < units.length; ++i) {
chrome.test.assertEq(testData[i].id, units[i].id);
+ chrome.test.assertEq(testData[i].name, units[i].name);
+ chrome.test.assertEq(testData[i].location, units[i].location);
+ chrome.test.assertEq(testData[i].vendorName, units[i].vendorName);
+ chrome.test.assertEq(testData[i].modelName, units[i].modelName);
chrome.test.assertEq(testData[i].type, units[i].type);
chrome.test.assertEq(testData[i].capacity, units[i].capacity);
+ // The available capacity is increased by a fixed step each time it
+ // is queried.
+ testData[i].availableCapacity += testData[i].step;
chrome.test.assertEq(testData[i].availableCapacity,
units[i].availableCapacity);
- testData[i].availableCapacity += testData[i].step;
}
}));
},
@@ -35,17 +44,15 @@ chrome.test.runTests([
var callbackCompleted = chrome.test.callbackAdded();
chrome.systemInfo.storage.onAvailableCapacityChanged.addListener(
function listener(changeInfo) {
+ // The free space on the first item will never be changed.
+ chrome.test.assertFalse(testData[0].id == changeInfo.id);
for (var i = 0; i < testData.length; ++i) {
if (changeInfo.id == testData[i].id) {
- // Increase its availableCapacity since it will be queried before
- // triggering onChanged event.
- testData[i].availableCapacity += testData[i].step;
- chrome.test.assertEq(testData[i].availableCapacity,
- changeInfo.availableCapacity);
+ var delta = changeInfo.newValue - changeInfo.oldValue;
+ chrome.test.assertEq(testData[i].step, delta);
break;
}
}
-
if (i >= testData.length)
chrome.test.fail("No matched storage id is found!");

Powered by Google App Engine
This is Rietveld 408576698