From e2d5c268aa9dc7d37197560588fe9088741fb6d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 11 Aug 2016 11:06:03 +0200 Subject: Fix timer-sent events in the websocket example --- test/examples_SUITE.erl | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'test') 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 -- cgit v1.2.3