diff options
author | Loïc Hoguin <[email protected]> | 2016-08-11 11:06:03 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-08-11 11:06:03 +0200 |
commit | e2d5c268aa9dc7d37197560588fe9088741fb6d1 (patch) | |
tree | e79a7edac7de369b0b0a1dba47734b7353145314 /test/examples_SUITE.erl | |
parent | 5fa5ba8ca494072a3d1f72ca8df6ffce984f2237 (diff) | |
download | cowboy-e2d5c268aa9dc7d37197560588fe9088741fb6d1.tar.gz cowboy-e2d5c268aa9dc7d37197560588fe9088741fb6d1.tar.bz2 cowboy-e2d5c268aa9dc7d37197560588fe9088741fb6d1.zip |
Fix timer-sent events in the websocket example
Diffstat (limited to 'test/examples_SUITE.erl')
-rw-r--r-- | test/examples_SUITE.erl | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/test/examples_SUITE.erl b/test/examples_SUITE.erl index b9cc7ba..25cf7e4 100644 --- a/test/examples_SUITE.erl +++ b/test/examples_SUITE.erl @@ -393,12 +393,27 @@ websocket(_) -> Msg1 -> exit({connection_failed, Msg1}) end, + %% Check that we receive the message sent on timer on init. + receive + {gun_ws, Pid, {text, <<"Hello!">>}} -> + ok + after 2000 -> + exit(timeout) + end, + %% Check that we receive subsequent messages sent on timer. + receive + {gun_ws, Pid, {text, <<"How' you doin'?">>}} -> + ok + after 2000 -> + exit(timeout) + end, + %% Check that we receive the echoed message. gun:ws_send(Pid, {text, <<"hello">>}), receive {gun_ws, Pid, {text, <<"That's what she said! hello">>}} -> - ok; - Msg2 -> - exit({receive_failed, Msg2}) + ok + after 500 -> + exit(timeout) end, gun:ws_send(Pid, close) after |