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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-invalid-options.html

Issue 2796673003: Deflake suborigin-invalid-options.html (Closed)
Patch Set: Created 3 years, 8 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 | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-invalid-options.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-invalid-options.html b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-invalid-options.html
index 6d3b8aadaebeecfb3c5cde8c9d166e204801ee3a..16483cacc5e942bc734ccc8ed4f52f40efa8651b 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-invalid-options.html
+++ b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-invalid-options.html
@@ -16,24 +16,36 @@ var test_suborigin_options = [
[ 'foobar \'b@d character$\'', 'Bad characters in option' ],
];
-for (option in test_suborigin_options) {
- async_test(t => {
- var id = option;
- var iframe;
- window.addEventListener('message', t.step_func(event => {
- if (event.source != iframe.contentWindow)
- return;
+var tests = [];
+
+function run_next_test() {
+ if (tests.length) {
+ tests.shift()();
+ }
+}
+
+function generate_test_case(option) {
+ var test = async_test(test_suborigin_options[option][1]);
+ var iframe;
+ window.addEventListener('message', test.step_func(event => {
+ if (event.source != iframe.contentWindow)
+ return;
- assert_equals(event.data, 'I am a secret');
- t.done();
- }));
- iframe = document.createElement('iframe');
- iframe.setAttribute('src',
- 'resources/reach-into-iframe.php?childsuborigin=' +
- test_suborigin_options[id][0]);
- document.body.appendChild(iframe);
- }, test_suborigin_options[option][1]);
+ assert_equals(event.data, 'I am a secret');
+ setTimeout(run_next_test, 0);
+ test.done();
+ }));
+ iframe = document.createElement('iframe');
+ iframe.setAttribute('src', 'resources/reach-into-iframe.php?childsuborigin=' +
+ test_suborigin_options[option][0]);
+ return () => { document.body.appendChild(iframe) };
}
+
+for (option in test_suborigin_options) {
+ tests.push(generate_test_case(option));
+}
+
+run_next_test();
</script>
</body>
</html>
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698