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

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

Issue 10836341: Add the basic code skeleton for system info event router (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Refine the implementations for storage event. Created 8 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
« no previous file with comments | « chrome/common/extensions/api/experimental_system_info_storage.idl ('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/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..f0fc3f9c2547427b48a87a65e4730e5ec997c696 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,7 +7,7 @@
chrome.systemInfo = chrome.experimental.systemInfo;
chrome.test.runTests([
- function testGet() {
+ function testStorageGet() {
chrome.systemInfo.storage.get(chrome.test.callbackPass(function(info) {
chrome.test.assertTrue(info.units.length == 1);
var unit = info.units[0];
@@ -16,5 +16,19 @@ chrome.test.runTests([
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 - numOfChangedEvent*step));
+ if (++ numOfChangedEvent > 5)
+ doneChangedEvent();
+ });
+ },
]);
« no previous file with comments | « chrome/common/extensions/api/experimental_system_info_storage.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698