Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 function create_window_in_test(t) { | 1 function create_window_in_test(t) { |
| 2 let p = new Promise((resolve) => { | 2 let p = new Promise((resolve) => { |
| 3 let f = document.createElement('iframe'); | 3 let f = document.createElement('iframe'); |
| 4 f.srcdoc = ''; | 4 f.srcdoc = ''; |
| 5 f.onload = (event) => { | 5 f.onload = (event) => { |
| 6 let w = f.contentWindow; | 6 let w = f.contentWindow; |
| 7 t.add_cleanup(() => f.remove()); | 7 t.add_cleanup(() => f.remove()); |
| 8 resolve(w); | 8 resolve(w); |
| 9 }; | 9 }; |
| 10 document.body.appendChild(f); | 10 document.body.appendChild(f); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 let exception; | 25 let exception; |
| 26 assert_throws(code, () => { | 26 assert_throws(code, () => { |
| 27 try { | 27 try { |
| 28 func.call(this); | 28 func.call(this); |
| 29 } catch(e) { | 29 } catch(e) { |
| 30 exception = e; | 30 exception = e; |
| 31 throw e; | 31 throw e; |
| 32 } | 32 } |
| 33 }, description); | 33 }, description); |
| 34 assert_true(exception instanceof global_context.DOMException, 'DOMException on the appropriate window'); | 34 assert_true(exception instanceof global_context.DOMException, 'DOMException on the appropriate window'); |
| 35 } | 35 } |
| 36 | |
| 37 function assert_array_equals_callback_invocations(actual, expected, description) { | |
|
dominicc (has gone to gerrit)
2016/07/25 07:56:14
Maybe don't put 'array_equals' in the name of this
| |
| 38 assert_equals(actual.length, expected.length); | |
| 39 for (let len=actual.length, i=0; i<len; ++i) { | |
| 40 let callback = expected[i][0]; | |
| 41 assert_equals(actual[i][0], expected[i][0], callback + ' callback should be invoked'); | |
| 42 assert_equals(actual[i][1], expected[i][1], callback + ' should be invoked o n the element ' + expected[i][1]); | |
| 43 assert_array_equals(actual[i][2], expected[i][2], callback + ' should be inv oked with the arguments ' + expected[i][2]); | |
| 44 } | |
| 45 } | |
| OLD | NEW |