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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js

Issue 2790143003: Cache Storage API tests: Fix WPT test bugs, remove redundant local copies (Closed)
Patch Set: Created 3 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 | « no previous file | third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/script-tests/cache-add.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js b/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js
index d3b81094219780ec3033fff35d03d5b12d2d32a0..6bc3a8685726d97d492cc41e97a657949820949d 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/resources/test-helpers.js
@@ -236,6 +236,30 @@ function assert_response_in_array(actual, expected_array, description) {
}), description);
}
+// Helper for testing with Request objects. Compares simple
+// attributes defined on the interfaces, as well as the headers.
+function assert_request_equals(actual, expected, description) {
+ assert_class_string(actual, "Request", description);
+ ["url"].forEach(function(attribute) {
+ assert_equals(actual[attribute], expected[attribute],
+ description + " Attributes differ: " + attribute + ".");
+ });
+ assert_header_equals(actual.headers, expected.headers, description);
+}
+
+// Asserts that two arrays |actual| and |expected| contain the same
+// set of Requests as determined by assert_request_equals(). The
+// corresponding elements must occupy corresponding indices in their
+// respective arrays.
+function assert_request_array_equals(actual, expected, description) {
+ assert_true(Array.isArray(actual), description);
+ assert_equals(actual.length, expected.length, description);
+ actual.forEach(function(value, index) {
+ assert_request_equals(value, expected[index],
+ description + " : object[" + index + "]");
+ });
+}
+
// Deletes all caches, returning a promise indicating success.
function delete_all_caches() {
return self.caches.keys()
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/external/wpt/service-workers/cache-storage/script-tests/cache-add.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698