|
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> |
|
14 |
|
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"> |
|
21 |
|
22 </div> |
|
23 <pre id="test"> |
|
24 <script class="testbody" type="text/javascript"> |
|
25 |
|
26 devicestorage_setup() |
|
27 |
|
28 storage = navigator.getDeviceStorage("pictures"); |
|
29 |
|
30 |
|
31 throws = false; |
|
32 try { |
|
33 var cursor = storage.enumerate(); |
|
34 } catch(e) {throws = true} |
|
35 ok(!throws, "enumerate no parameter"); |
|
36 |
|
37 throws = false; |
|
38 try { |
|
39 var cursor = storage.enumerate("string"); |
|
40 } catch(e) {throws = true} |
|
41 ok(!throws, "enumerate one string parameter"); |
|
42 |
|
43 throws = false; |
|
44 try { |
|
45 var cursor = storage.enumerate("string", "string2"); |
|
46 } catch(e) {throws = true} |
|
47 ok(throws, "enumerate two string parameter"); |
|
48 |
|
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"); |
|
54 |
|
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"); |
|
60 |
|
61 throws = false; |
|
62 try { |
|
63 var cursor = storage.enumerate({}, "string"); |
|
64 } catch(e) {throws = true} |
|
65 ok(throws, "enumerate object then a string"); |
|
66 |
|
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"); |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 devicestorage_cleanup() |
|
77 </script> |
|
78 </pre> |
|
79 </body> |
|
80 </html> |
|
81 |