1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/datastore/tests/file_event_receiver.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,45 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <meta charset="utf-8"> 1.8 + <title>Test for DataStore - event receiver</title> 1.9 +</head> 1.10 +<body> 1.11 +<script type="application/javascript;version=1.7"> 1.12 + 1.13 + function ok(a, msg) { 1.14 + alert((a ? 'OK' : 'KO') + ' ' + msg) 1.15 + } 1.16 + 1.17 + function is(a, b, msg) { 1.18 + ok(a === b, msg); 1.19 + } 1.20 + 1.21 + function cbError() { 1.22 + alert('KO error'); 1.23 + } 1.24 + 1.25 + function finish() { 1.26 + alert('DONE'); 1.27 + } 1.28 + 1.29 + function eventListener(evt) { 1.30 + ok(evt, "OnChangeListener is called with data"); 1.31 + finish(); 1.32 + } 1.33 + 1.34 + navigator.getDataStores('foo').then(function(stores) { 1.35 + is(stores.length, 1, "getDataStores('foo') returns 1 element"); 1.36 + is(stores[0].name, 'foo', 'The dataStore.name is foo'); 1.37 + is(stores[0].readOnly, false, 'The dataStore foo is not in readonly'); 1.38 + 1.39 + var store = stores[0]; 1.40 + store.onchange = eventListener; 1.41 + alert("READY"); 1.42 + }); 1.43 + 1.44 +</script> 1.45 +</body> 1.46 +</html> 1.47 + 1.48 +