dom/devicestorage/test/test_enumerateOptions.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/devicestorage/test/test_enumerateOptions.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,81 @@
     1.4 +<!--
     1.5 +  Any copyright is dedicated to the Public Domain.
     1.6 +  http://creativecommons.org/publicdomain/zero/1.0/
     1.7 +-->
     1.8 +<!DOCTYPE HTML>
     1.9 +<html>
    1.10 +<!--
    1.11 +https://bugzilla.mozilla.org/show_bug.cgi?id=717103
    1.12 +-->
    1.13 +<head>
    1.14 +  <title>Test for basic sanity of the device storage API </title>
    1.15 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.16 +  <script type="text/javascript" src="devicestorage_common.js"></script>
    1.17 +
    1.18 +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.19 +</head>
    1.20 +<body>
    1.21 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a>
    1.22 +<p id="display"></p>
    1.23 +<div id="content" style="display: none">
    1.24 +  
    1.25 +</div>
    1.26 +<pre id="test">
    1.27 +<script class="testbody" type="text/javascript">
    1.28 +
    1.29 +devicestorage_setup()
    1.30 +
    1.31 +storage = navigator.getDeviceStorage("pictures");
    1.32 +
    1.33 +
    1.34 +throws = false;
    1.35 +try {
    1.36 +var cursor = storage.enumerate();
    1.37 +} catch(e) {throws = true}
    1.38 +ok(!throws, "enumerate no parameter");
    1.39 +
    1.40 +throws = false;
    1.41 +try {
    1.42 +var cursor = storage.enumerate("string");
    1.43 +} catch(e) {throws = true}
    1.44 +ok(!throws, "enumerate one string parameter");
    1.45 +
    1.46 +throws = false;
    1.47 +try {
    1.48 +var cursor = storage.enumerate("string", "string2");
    1.49 +} catch(e) {throws = true}
    1.50 +ok(throws, "enumerate two string parameter");
    1.51 +
    1.52 +throws = false;
    1.53 +try {
    1.54 +var cursor = storage.enumerate("string", {"since": new Date(1)});
    1.55 +} catch(e) {throws = true}
    1.56 +ok(!throws, "enumerate a string and object parameter");
    1.57 +
    1.58 +throws = false;
    1.59 +try {
    1.60 +var cursor = storage.enumerate({"path": "a"});
    1.61 +} catch(e) {throws = true}
    1.62 +ok(!throws, "enumerate object parameter with path");
    1.63 +
    1.64 +throws = false;
    1.65 +try {
    1.66 +var cursor = storage.enumerate({}, "string");
    1.67 +} catch(e) {throws = true}
    1.68 +ok(throws, "enumerate object then a string");
    1.69 +
    1.70 +throws = false;
    1.71 +try {
    1.72 +var cursor = storage.enumerate({"path": "a", "since": new Date(0) });
    1.73 +} catch(e) {throws = true}
    1.74 +ok(!throws, "enumerate object parameter with path");
    1.75 +
    1.76 +
    1.77 +
    1.78 +
    1.79 +devicestorage_cleanup()
    1.80 +</script>
    1.81 +</pre>
    1.82 +</body>
    1.83 +</html>
    1.84 +

mercurial