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

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

Issue 1485283002: Sync Cache API tests w/ web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js
index 2448aaf6eb92654c233b51cc7165fa4c7d622b8c..9851e912586b464fccbad23eb1eba036bf4ec60a 100644
--- a/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js
+++ b/third_party/WebKit/LayoutTests/http/tests/cachestorage/script-tests/cache-add.js
@@ -56,6 +56,22 @@ cache_test(function(cache) {
cache_test(function(cache) {
var request = new Request('../resources/simple.txt');
+ return cache.add(request)
+ .then(function(result) {
+ assert_equals(result, undefined,
+ 'Cache.add should resolve with undefined on success.');
+ })
+ .then(function() {
+ return cache.add(request);
+ })
+ .then(function(result) {
+ assert_equals(result, undefined,
+ 'Cache.add should resolve with undefined on success.');
+ });
+ }, 'Cache.add called twice with the same Request object');
+
+cache_test(function(cache) {
+ var request = new Request('../resources/simple.txt');
return request.text()
.then(function() {
assert_false(request.bodyUsed);
@@ -154,7 +170,9 @@ cache_test(function(cache) {
var urls = ['../resources/simple.txt',
self.location.href,
'../resources/blank.html'];
- var requests = urls.map(function(url) { return new Request(url); });
+ var requests = urls.map(function(url) {
+ return new Request(url);
+ });
return cache.addAll(requests)
.then(function(result) {
assert_equals(result, undefined,
@@ -192,7 +210,9 @@ cache_test(function(cache) {
var urls = ['../resources/simple.txt',
'this-resource-should-not-exist',
'../resources/blank.html'];
- var requests = urls.map(function(url) { return new Request(url); });
+ var requests = urls.map(function(url) {
+ return new Request(url);
+ });
return cache.addAll(requests)
.then(function(result) {
assert_equals(result, undefined,
@@ -227,4 +247,13 @@ cache_test(function(cache) {
});
}, 'Cache.addAll with a mix of succeeding and failing requests');
+cache_test(function(cache) {
+ var request = new Request('../resources/simple.txt');
+ return assert_promise_rejects(
+ cache.addAll([request, request]),
+ 'InvalidStateError',
+ 'Cache.addAll should throw InvalidStateError 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