| 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!");
|
|
|
|
|