Skip to content

Commit

Permalink
Merge pull request #9460 from youennf/wpt-export-for-webkit-182637
Browse files Browse the repository at this point in the history
  • Loading branch information
youennf committed Feb 9, 2018
2 parents 92d4935 + 76c9cef commit fade9e6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions service-workers/cache-storage/script-tests/cache-put.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,12 @@ cache_test(function(cache) {
});
}, 'Cache.put should store Response.redirect() correctly');

cache_test(async (cache) => {
var request = new Request(test_url);
var response = new Response(new Blob([test_body]));
await cache.put(request, response);
var cachedResponse = await cache.match(request);
assert_equals(await cachedResponse.text(), test_body);
}, 'Cache.put called with simple Request and blob Response');

done();
13 changes: 13 additions & 0 deletions service-workers/cache-storage/window/cache-put.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,16 @@
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/test-helpers.js"></script>
<script src="../script-tests/cache-put.js"></script>
<script>
cache_test(async (cache) => {
var formData = new FormData();
formData.append("name", "value");

var request = new Request(test_url);
var response = new Response(formData);
await cache.put(request, response);
var cachedResponse = await cache.match(request);
var cachedResponseText = await cachedResponse.text();
assert_true(cachedResponseText.indexOf("name=\"name\"\r\n\r\nvalue") !== -1);
}, 'Cache.put called with simple Request and form data Response');
</script>

0 comments on commit fade9e6

Please sign in to comment.