summaryrefslogtreecommitdiffstats
path: root/dom/cache/test/xpcshell/test_migration.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/cache/test/xpcshell/test_migration.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/cache/test/xpcshell/test_migration.js')
-rw-r--r--dom/cache/test/xpcshell/test_migration.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/dom/cache/test/xpcshell/test_migration.js b/dom/cache/test/xpcshell/test_migration.js
new file mode 100644
index 000000000..8ccccda9d
--- /dev/null
+++ b/dom/cache/test/xpcshell/test_migration.js
@@ -0,0 +1,49 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ *
+ * All images in schema_15_profile.zip are from https://github.com/mdn/sw-test/
+ * and are CC licensed by https://www.flickr.com/photos/legofenris/.
+ */
+
+function run_test() {
+ do_test_pending();
+ create_test_profile('schema_15_profile.zip');
+
+ var cache;
+ caches.open('xpcshell-test').then(function(c) {
+ cache = c;
+ ok(cache, 'cache exists');
+ return cache.keys();
+ }).then(function(requestList) {
+ ok(requestList.length > 0, 'should have at least one request in cache');
+ requestList.forEach(function(request) {
+ ok(request, 'each request in list should be non-null');
+ ok(request.redirect === 'follow', 'request.redirect should default to "follow"');
+ ok(request.cache === 'default', 'request.cache should have been updated to "default"' + request.cache);
+ ok(request.mode === 'navigate', 'request.mode should have been updated to "navigate"');
+ ok(request.referrerPolicy === 'no-referrer-when-downgrade', 'request.referrerPolicy should have been updated to "no-referrer-when-downgrade"');
+ });
+ return Promise.all(requestList.map(function(request) {
+ return cache.match(request);
+ }));
+ }).then(function(responseList) {
+ ok(responseList.length > 0, 'should have at least one response in cache');
+ responseList.forEach(function(response) {
+ ok(response, 'each response in list should be non-null');
+ // reponse.url is a empty string in current test file. It should test for
+ // not being a empty string once thet test file is updated.
+ ok(typeof response.url === 'string', 'each response.url in list should be a string');
+ // reponse.redirected may be changed once test file is updated. It should
+ // be false since current reponse.url is a empty string.
+ ok(response.redirected === false, 'each response.redirected in list should be false');
+ do_check_eq(response.headers.get('Content-Type'), 'text/plain;charset=UTF-8',
+ 'the response should have the correct header');
+ });
+ }).then(function() {
+ do_test_finished();
+ }).catch(function(e) {
+ ok(false, 'caught exception ' + e);
+ do_test_finished();
+ });
+}