| <!DOCTYPE html> |
| <meta charset="utf-8"> |
| <title>WebStorage Test: Storage - set value with enumerate</title> |
| <link rel="author" title="Intel" href="http://www.intel.com"> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <div id="log"></div> |
| <script> |
| var store_list = [ |
| ["key0", "value0"], |
| ["key1", "value1"], |
| ["key2", "value2"] |
| ]; |
| ["localStorage", "sessionStorage"].forEach(function(name) { |
| test(function () { |
| var storage = window[name]; |
| storage.clear(); |
| |
| store_list.forEach(function(item) { |
| storage.setItem(item[0], item[1]); |
| }); |
| |
| for (var i = 0; i < store_list.length; i++) { |
| var value = storage.getItem("key" + i); |
| assert_equals(value, "value" + i); |
| } |
| }, "enumerate a " + name + " object with the key and get the values"); |
| }); |
| </script> |
| |