dom/devicestorage/test/test_sanity.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/devicestorage/test/test_sanity.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     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 +ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
    1.32 +
    1.33 +var storage;
    1.34 +
    1.35 +var throws = false;
    1.36 +try {
    1.37 + storage = navigator.getDeviceStorage();
    1.38 +} catch(e) {throws = true}
    1.39 +ok(throws, "getDeviceStorage takes one arg");
    1.40 +
    1.41 +storage = navigator.getDeviceStorage("kilimanjaro");
    1.42 +ok(!storage, "kilimanjaro - Should not have this type of storage");
    1.43 +
    1.44 +storage = navigator.getDeviceStorage("pictures");
    1.45 +ok(storage, "pictures - Should have getDeviceStorage");
    1.46 +
    1.47 +storage = navigator.getDeviceStorage("music");
    1.48 +ok(storage, "music - Should have getDeviceStorage");
    1.49 +
    1.50 +storage = navigator.getDeviceStorage("videos");
    1.51 +ok(storage, "videos - Should have getDeviceStorage");
    1.52 +
    1.53 +var cursor = storage.enumerate();
    1.54 +ok(cursor, "Should have a non-null cursor");
    1.55 +
    1.56 +devicestorage_cleanup();
    1.57 +
    1.58 +</script>
    1.59 +</pre>
    1.60 +</body>
    1.61 +</html>
    1.62 +

mercurial