blob: 12867694f856f1e618cdc87515c1dba640de9f41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// META: title=EventSource: lines and data parsing
var test = async_test();
test.step(function() {
var source = new EventSource("resources/message2.py"),
counter = 0;
source.onmessage = test.step_func(function(e) {
if(counter == 0) {
assert_equals(e.data,"msg\nmsg");
} else if(counter == 1) {
assert_equals(e.data,"");
} else if(counter == 2) {
assert_equals(e.data,"end");
source.close();
test.done();
} else {
assert_unreached();
}
counter++;
});
});
|