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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/cache-storage-worker.js

Issue 1043213003: Remove redundant serviceworker/cache-* tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Re-add fetch-status.php, used by fetch tests in sibling dir 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
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/cache-storage-match-worker.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/resources/cache-storage-worker.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/cache-storage-worker.js b/LayoutTests/http/tests/serviceworker/resources/cache-storage-worker.js
deleted file mode 100644
index cc2da0c8428d44b2b28a5c9ee10739b9249f1c11..0000000000000000000000000000000000000000
--- a/LayoutTests/http/tests/serviceworker/resources/cache-storage-worker.js
+++ /dev/null
@@ -1,187 +0,0 @@
-importScripts('worker-testharness.js');
-importScripts('../../resources/testharness-helpers.js');
-
-promise_test(function(t) {
- var cache_name = 'cache-storage/foo';
- return self.caches.delete(cache_name)
- .then(function() {
- return self.caches.open(cache_name);
- })
- .then(function(cache) {
- assert_true(cache instanceof Cache,
- 'CacheStorage.open should return a Cache.');
- });
- }, 'CacheStorage.open');
-
-promise_test(function(t) {
- // Note that this test may collide with other tests running in the same
- // origin that also uses an empty cache name.
- var cache_name = '';
- return self.caches.delete(cache_name)
- .then(function() {
- return self.caches.open(cache_name);
- })
- .then(function(cache) {
- assert_true(cache instanceof Cache,
- 'CacheStorage.open should accept an empty name.');
- });
- }, 'CacheStorage.open with an empty name');
-
-promise_test(function(t) {
- return assert_promise_rejects(
- self.caches.open(),
- new TypeError(),
- 'CacheStorage.open should throw TypeError if called with no arguments.');
- }, 'CacheStorage.open with no arguments');
-
-promise_test(function(t) {
- var test_cases = [
- {
- name: 'cache-storage/lowercase',
- should_not_match:
- [
- 'cache-storage/Lowercase',
- ' cache-storage/lowercase',
- 'cache-storage/lowercase '
- ]
- },
- {
- name: 'cache-storage/has a space',
- should_not_match:
- [
- 'cache-storage/has'
- ]
- },
- {
- name: 'cache-storage/has\000_in_the_name',
- should_not_match:
- [
- 'cache-storage/has',
- 'cache-storage/has_in_the_name'
- ]
- }
- ];
- return Promise.all(test_cases.map(function(testcase) {
- var cache_name = testcase.name;
- return self.caches.delete(cache_name)
- .then(function() {
- return self.caches.open(cache_name);
- })
- .then(function() {
- return self.caches.has(cache_name);
- })
- .then(function(result) {
- assert_true(result,
- 'CacheStorage.has should return true for existing ' +
- 'cache.');
- })
- .then(function() {
- return Promise.all(
- testcase.should_not_match.map(function(cache_name) {
- return self.caches.has(cache_name)
- .then(function(result) {
- assert_false(result,
- 'CacheStorage.has should only perform ' +
- 'exact matches on cache names.');
- });
- }));
- })
- .then(function() {
- return self.caches.delete(cache_name);
- });
- }));
- }, 'CacheStorage.has with existing cache');
-
-promise_test(function(t) {
- return self.caches.has('cheezburger')
- .then(function(result) {
- assert_false(result,
- 'CacheStorage.has should return false for ' +
- 'nonexistent cache.');
- });
- }, 'CacheStorage.has with nonexistent cache');
-
-promise_test(function(t) {
- var cache_name = 'cache-storage/open';
- var cache;
- return self.caches.delete(cache_name)
- .then(function() {
- return self.caches.open(cache_name);
- })
- .then(function(result) {
- cache = result;
- })
- .then(function() {
- return self.caches.open(cache_name);
- })
- .then(function(result) {
- assert_equals(result, cache,
- 'CacheStorage.open should return the named Cache ' +
- 'object if it exists.');
- })
- .then(function() {
- return self.caches.open(cache_name);
- })
- .then(function(result) {
- assert_equals(result, cache,
- 'CacheStorage.open should return the same ' +
- 'instance of an existing Cache object.');
- });
- }, 'CacheStorage.open with existing cache');
-
-promise_test(function(t) {
- var cache_name = 'cache-storage/delete';
-
- return self.caches.delete(cache_name)
- .then(function() {
- return self.caches.open(cache_name);
- })
- .then(function() { return self.caches.delete(cache_name); })
- .then(function(result) {
- assert_true(result,
- 'CacheStorage.delete should return true after ' +
- 'deleting an existing cache.');
- })
-
- .then(function() { return self.caches.has(cache_name); })
- .then(function(cache_exists) {
- assert_false(cache_exists,
- 'CacheStorage.has should return false after ' +
- 'fulfillment of CacheStorage.delete promise.');
- });
- }, 'CacheStorage.delete with existing cache');
-
-promise_test(function(t) {
- return self.caches.delete('cheezburger')
- .then(function(result) {
- assert_false(result,
- 'CacheStorage.delete should return false for a ' +
- 'nonexistent cache.');
- });
- }, 'CacheStorage.delete with nonexistent cache');
-
-promise_test(function(t) {
- var bad_name = 'unpaired\uD800';
- var converted_name = 'unpaired\uFFFD'; // Don't create cache with this name.
- return self.caches.has(converted_name)
- .then(function(cache_exists) {
- assert_false(cache_exists,
- 'Test setup failure: cache should not exist');
- })
- .then(function() { return self.caches.open(bad_name); })
- .then(function() { return self.caches.keys(); })
- .then(function(keys) {
- assert_true(keys.indexOf(bad_name) !== -1,
- 'keys should include cache with bad name');
- })
- .then(function() { return self.caches.has(bad_name); })
- .then(function(cache_exists) {
- assert_true(cache_exists,
- 'CacheStorage names should be not be converted.');
- })
- .then(function() { return self.caches.has(converted_name); })
- .then(function(cache_exists) {
- assert_false(cache_exists,
- 'CacheStorage names should be not be converted.');
- });
- }, 'CacheStorage names are DOMStrings not USVStrings');
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/cache-storage-match-worker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698