Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: LayoutTests/http/tests/cachestorage/script-tests/cache-add.js

Issue 1032623008: Expose Cache Storage API in global window/worker scope (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update webexposed expectations Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/cachestorage/script-tests/cache-add.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/cache-add-worker.js b/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js
similarity index 76%
copy from LayoutTests/http/tests/serviceworker/resources/cache-add-worker.js
copy to LayoutTests/http/tests/cachestorage/script-tests/cache-add.js
index f1ea9738bce34d092c776879dc5b12392d7ea971..0f85d120f8f9e280cc50ab5075fe67921aa182c9 100644
--- a/LayoutTests/http/tests/serviceworker/resources/cache-add-worker.js
+++ b/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js
@@ -1,5 +1,8 @@
-importScripts('worker-testharness.js');
-importScripts('/resources/testharness-helpers.js');
+if (self.importScripts) {
+ importScripts('/resources/testharness.js');
+ importScripts('/resources/testharness-helpers.js');
+ importScripts('../resources/test-helpers.js');
+}
cache_test(function(cache) {
return assert_promise_rejects(
@@ -9,7 +12,7 @@ cache_test(function(cache) {
}, 'Cache.add called with no arguments');
cache_test(function(cache) {
- return cache.add('simple.txt')
+ return cache.add('../resources/simple.txt')
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
@@ -24,7 +27,7 @@ cache_test(function(cache) {
}, 'Cache.add called with non-HTTP/HTTPS URL');
cache_test(function(cache) {
- var request = new Request('simple.txt', {method: 'POST', body: 'Hello'});
+ var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
return cache.add(request)
.then(function(result) {
assert_equals(result, undefined,
@@ -33,7 +36,7 @@ cache_test(function(cache) {
}, 'Cache.add called with Request object');
cache_test(function(cache) {
- var request = new Request('simple.txt', {method: 'POST', body: 'Hello'});
+ var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
return request.text()
.then(function() {
assert_true(request.bodyUsed);
@@ -48,7 +51,7 @@ cache_test(function(cache) {
}, 'Cache.add called with Request object with a used body');
cache_test(function(cache) {
- var request = new Request('simple.txt', {method: 'POST', body: 'Hello'});
+ var request = new Request('../resources/simple.txt', {method: 'POST', body: 'Hello'});
return cache.add(request)
.then(function(result) {
assert_equals(result, undefined,
@@ -71,7 +74,7 @@ cache_test(function(cache) {
}, 'Cache.add with request that results in a status of 404');
cache_test(function(cache) {
- return cache.add('fetch-status.php?status=500')
+ return cache.add('../resources/fetch-status.php?status=500')
.then(function(result) {
assert_equals(result, undefined,
'Cache.add should resolve with undefined on success.');
@@ -86,9 +89,8 @@ cache_test(function(cache) {
}, 'Cache.addAll with no arguments');
cache_test(function(cache) {
- // Assumes the existence of simple.txt and blank.html in the same directory
- // as this test script.
- var urls = ['simple.txt', undefined, 'blank.html'];
+ // Assumes the existence of ../resources/simple.txt and ../resources/blank.html
+ var urls = ['../resources/simple.txt', undefined, '../resources/blank.html'];
return assert_promise_rejects(
cache.addAll(),
new TypeError(),
@@ -96,9 +98,8 @@ cache_test(function(cache) {
}, 'Cache.addAll with a mix of valid and undefined arguments');
cache_test(function(cache) {
- // Assumes the existence of simple.txt and blank.html in the same directory
- // as this test script.
- var urls = ['simple.txt', self.location.href, 'blank.html'];
+ // Assumes the existence of ../resources/simple.txt and ../resources/blank.html
+ var urls = ['../resources/simple.txt', self.location.href, '../resources/blank.html'];
return cache.addAll(urls)
.then(function(result) {
assert_equals(result, undefined,
@@ -108,9 +109,8 @@ cache_test(function(cache) {
}, 'Cache.addAll with string URL arguments');
cache_test(function(cache) {
- // Assumes the existence of simple.txt and blank.html in the same directory
- // as this test script.
- var urls = ['simple.txt', self.location.href, 'blank.html'];
+ // Assumes the existence of ../resources/simple.txt and ../resources/blank.html
+ var urls = ['../resources/simple.txt', self.location.href, '../resources/blank.html'];
var requests = urls.map(function(url) {
return new Request(url);
});
@@ -123,9 +123,9 @@ cache_test(function(cache) {
}, 'Cache.addAll with Request arguments');
cache_test(function(cache) {
- // Assumes that simple.txt and blank.html exist. The second
+ // Assumes that ../resources/simple.txt and ../resources/blank.html exist. The second
// resource does not.
- var urls = ['simple.txt', 'this-resource-should-not-exist', 'blank.html'];
+ var urls = ['../resources/simple.txt', 'this-resource-should-not-exist', '../resources/blank.html'];
var requests = urls.map(function(url) {
return new Request(url);
});
@@ -138,10 +138,12 @@ cache_test(function(cache) {
}, 'Cache.addAll with a mix of succeeding and failing requests');
cache_test(function(cache) {
- var request = new Request('simple.txt');
+ var request = new Request('../resources/simple.txt');
return assert_promise_rejects(
cache.addAll([request, request]),
new TypeError(),
'Cache.addAll should throw TypeError if the same request is added ' +
'twice.');
}, 'Cache.addAll called with the same Request object specified twice');
+
+done();

Powered by Google App Engine
This is Rietveld 408576698