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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/support/alertAssert.sub.js

Issue 2695813009: Import wpt@503f5b5f78ec4e87d144f78609f363f0ed0ea8db (Closed)
Patch Set: Skip some tests Created 3 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 // note, this template substitution is XSS, but no way to avoid it in this frame work
2 var expected_alerts = {{GET[alerts]}};
3 var timeout= "{{GET[timeout]}}";
4 if (timeout == "") {
5 timeout = 2;
6 }
7
8 if(expected_alerts.length == 0) {
9 function alert_assert(msg) {
10 test(function () { assert_unreached(msg) });
11 }
12 } else {
13 var t_alert = async_test('Expecting alerts: {{GET[alerts]}}');
14 step_timeout(function() {
15 if(t_alert.phase != t_alert.phases.COMPLETE) {
16 t_alert.step(function() { assert_unreached('Alert timeout, expected alerts ' + expected_alerts + ' not fired.') });
17 t_alert.done();
18 }
19 }, timeout * 1000);
20 var alert_assert = function (msg) {
21 t_alert.step(function () {
22 if(msg && msg instanceof Error) {
23 msg = msg.message;
24 }
25 if (msg && msg.match(/^FAIL/i)) {
26 assert_unreached(msg);
27 t_alert.done();
28 }
29 for (var i = 0; i < expected_alerts.length; i++) {
30 if (expected_alerts[i] == msg) {
31 assert_true(expected_alerts[i] == msg);
32 expected_alerts.splice(i, 1);
33 if (expected_alerts.length == 0) {
34 t_alert.done();
35 }
36 return;
37 }
38 }
39 assert_unreached('unexpected alert: ' + msg);
40 t_log.done();
41 });
42 }.bind(this);
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698