Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <!--
2 Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/
4 -->
5 <!DOCTYPE HTML>
6 <html>
7 <!--
8 https://bugzilla.mozilla.org/show_bug.cgi?id=717103
9 -->
10 <head>
11 <title>Test for basic sanity of the device storage API </title>
12 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
13 <script type="text/javascript" src="devicestorage_common.js"></script>
15 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
16 </head>
17 <body>
18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a>
19 <p id="display"></p>
20 <div id="content" style="display: none">
22 </div>
23 <pre id="test">
24 <script class="testbody" type="text/javascript">
26 devicestorage_setup()
28 storage = navigator.getDeviceStorage("pictures");
31 throws = false;
32 try {
33 var cursor = storage.enumerate();
34 } catch(e) {throws = true}
35 ok(!throws, "enumerate no parameter");
37 throws = false;
38 try {
39 var cursor = storage.enumerate("string");
40 } catch(e) {throws = true}
41 ok(!throws, "enumerate one string parameter");
43 throws = false;
44 try {
45 var cursor = storage.enumerate("string", "string2");
46 } catch(e) {throws = true}
47 ok(throws, "enumerate two string parameter");
49 throws = false;
50 try {
51 var cursor = storage.enumerate("string", {"since": new Date(1)});
52 } catch(e) {throws = true}
53 ok(!throws, "enumerate a string and object parameter");
55 throws = false;
56 try {
57 var cursor = storage.enumerate({"path": "a"});
58 } catch(e) {throws = true}
59 ok(!throws, "enumerate object parameter with path");
61 throws = false;
62 try {
63 var cursor = storage.enumerate({}, "string");
64 } catch(e) {throws = true}
65 ok(throws, "enumerate object then a string");
67 throws = false;
68 try {
69 var cursor = storage.enumerate({"path": "a", "since": new Date(0) });
70 } catch(e) {throws = true}
71 ok(!throws, "enumerate object parameter with path");
76 devicestorage_cleanup()
77 </script>
78 </pre>
79 </body>
80 </html>