Index: third_party/WebKit/LayoutTests/external/wpt/clear-site-data/support/test_utils.js |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/clear-site-data/support/test_utils.js b/third_party/WebKit/LayoutTests/external/wpt/clear-site-data/support/test_utils.js |
index 6aff373f23a46d1887689618104c86c144cef108..35b0a01e5ecabd8ef7fe36e76576c6f514af909a 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/clear-site-data/support/test_utils.js |
+++ b/third_party/WebKit/LayoutTests/external/wpt/clear-site-data/support/test_utils.js |
@@ -74,6 +74,26 @@ var TestUtils = (function() { |
return combinations; |
})(); |
+ /** |
+ * Ensures that all datatypes are nonempty. Should be called in the test |
+ * setup phase. |
+ */ |
+ TestUtils.populateDatatypes = function() { |
+ return Promise.all(TestUtils.DATATYPES.map(function(datatype) { |
+ return new Promise(function(resolve, reject) { |
+ datatype.add().then(function() { |
+ datatype.isEmpty().then(function(isEmpty) { |
+ assert_false( |
+ isEmpty, |
+ datatype.name + |
+ " has to be nonempty before the test starts."); |
+ resolve(); |
+ }); |
+ }); |
+ }); |
+ })); |
+ }; |
+ |
/** |
* Get the support server URL that returns a Clear-Site-Data header |
* to clear |datatypes|. |