Chromium Code Reviews| 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 787ca408abbe912b1aefdc209792a16125c5fe7b..32136973dfccdd80e76abd6e304b1e583f18ca61 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 |
| @@ -7,14 +7,35 @@ |
| chrome.systemInfo = chrome.experimental.systemInfo; |
| chrome.test.runTests([ |
| - function testGet() { |
| - chrome.systemInfo.storage.get(chrome.test.callbackPass(function(info) { |
| - chrome.test.assertTrue(info.units.length == 1); |
| - var unit = info.units[0]; |
| - chrome.test.assertTrue(unit.id == "0xbeaf"); |
| - chrome.test.assertTrue(unit.type == "unknown"); |
| - chrome.test.assertTrue(unit.capacity == 4098); |
| - chrome.test.assertTrue(unit.availableCapacity == 1024); |
| - })); |
| - } |
| +function testStorageGet() { |
| + chrome.systemInfo.storage.get(chrome.test.callbackPass(function(info) { |
| + chrome.test.assertTrue(info.units.length == 1); |
| + var unit = info.units[0]; |
| + chrome.test.assertTrue(unit.id == "0xbeaf"); |
| + chrome.test.assertTrue(unit.type == "unknown"); |
| + chrome.test.assertTrue(unit.capacity == 4098); |
| + chrome.test.assertTrue(unit.availableCapacity == 1024); |
| + })); |
| +} |
| ]); |
| + |
| +function testChangedEvent() { |
| + var numOfChangedEvent = 0; |
| + var base = 10000; |
| + var step = 10; |
| + var doneChangedEvent = chrome.test.listenForever( |
| + chrome.systemInfo.storage.onAvailableCapacityChanged, |
| + function listener(changedInfo) { |
| + chrome.test.assertTrue(changedInfo.id == "/dev/sda1"); |
| + chrome.test.assertTrue( |
| + changedInfo.availableCapacity == (base - step*numOfChangedEvent)); |
| + if (++ numOfChangedEvent > 5) |
|
Mihai Parparita -not on Chrome
2012/09/01 00:20:53
Nit: no space after ++.
Hongbo Min
2012/09/02 02:47:12
Done.
|
| + doneChangedEvent(); |
| + }); |
| +} |
| + |
| +function onMessageReply() { |
| + chrome.test.runTests([testChangedEvent]); |
| +} |
| + |
| +chrome.test.sendMessage("ready", onMessageReply); |