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() |