;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\207" [require tls websocket cl] 2) #@149 Run BODY until true or TIMEOUT (in seconds) is reached. Will return false if the timeout was reached. This macro is not written to be used widely. (defalias 'websocket-test-wait-with-timeout '(macro . #[(timeout &rest body) "\302\303\304\305\306\307E\310BB\311\312 BB\313BBB\314BBB\207" [timeout body let ((begin (current-time)) (result nil)) while and < (- (float-time (time-subtract (current-time) begin))) ((not result)) setq result ((sleep-for 0.5)) (result)] 7 (#$ . 171)])) #@61 Run the main part of an ert test against WSTEST-SERVER-URL. (defalias 'websocket-functional-client-test #[(wstest-server-url) "\306\211\306\211\307\f\310\311\312\313%\314\315!)\306*\316\216\317 \306+,\320\321\317 ,\"![\322W\203@+\204@\323 !+\324\325!\210\202!+*\211))\204O\326*!\210*\314\315!-\306.\327\216\317 \306+,\320\321\317 ,\"![\322W\203\222+\204\222\330 !/>\204\204\331\332\333 D\"\210 \334H\335=+\324\325!\210\202a+*\211-)\204\241\326.!\210*\3360\3371\263\3401\n)C0\202\3002\33102@2A)D3\3414\3065\342\216\34303\"\2114)\204\334\3265!\210,\344 \345\"\210\314\315!6\3067\346\216\317 \306+,\320\321\317 ,\"![\347W\203+\204\n\345\232+\324\325!\210\202\363+*\2116)\204!\3267!\210*\350 !-\207" [tls-checktrust wstest-closed wstest-msg wstest-server-proc wstest-server-url wstest-ws nil websocket-open :on-message #[(_websocket frame) "\302!\211\207" [frame wstest-msg websocket-frame-text] 2] :on-close #[(_websocket) "\301\211\207" [wstest-closed t] 2] gensym "ert-form-evaluation-aborted-" #[nil "\302\303\304\305\257\306 !\207" [#1=#:value-632 #2=#:form-description-633 (should (websocket-test-wait-with-timeout 2 #3=(websocket-openp wstest-ws))) :form (let #6=((begin (current-time)) (result nil)) (while (and (< #7=(- (float-time (time-subtract (current-time) begin))) 2) . #8=((not result))) (setq result #3#) . #10=((sleep-for 0.5))) . #11=(result)) :value ert--signal-should-execution] 5] current-time float-time time-subtract 2 websocket-openp sleep-for 0.5 ert-fail #[nil "\302\303\304\305\257\306 !\207" [#4=#:value-634 #5=#:form-description-635 (should (websocket-test-wait-with-timeout 2 (eq #9='open (websocket-ready-state wstest-ws)))) :form (let #6# (while (and (< #7# 2) . #8#) (setq result (eq #9# (progn (or (progn (and (memq (type-of wstest-ws) cl-struct-websocket-tags) t)) (signal 'wrong-type-argument (list 'websocket wstest-ws))) (aref wstest-ws 1)))) . #10#) . #11#) :value ert--signal-should-execution] 5] type-of signal wrong-type-argument websocket 1 open null (error) ert--should-signal-hook #12=#:ert-form-evaluation-aborted-639 #[nil "\305C\306 BD\244\n\307=?\205\310\nD\244\n\307=?\205)\311\312N\211\205(\313\314 \"D)\244\315\f!\207" [#13=#:fn-636 #14=#:args-637 #15=#:value-638 -explainer- #16=#:form-description-640 (should (null wstest-msg)) :form #12# :value null ert-explainer :explanation apply ert--signal-should-execution] 6] apply websocket-send-text "Hi!" #[nil "\302\303\304\305\257\306 !\207" [#17=#:value-641 #18=#:form-description-642 (should (websocket-test-wait-with-timeout 5 #19=(equal wstest-msg "Hi!"))) :form (let #6# (while (and (< #7# 5) . #8#) (setq result #19#) . #10#) . #11#) :value ert--signal-should-execution] 5] 5 websocket-close #1# #2# result begin #4# #5# cl-struct-websocket-tags #13# signal-hook-function err #14# #15# #16# #17# #18#] 7 (#$ . 659)]) (byte-code "\300\301\302\303\301\304\305\304\306\304&\"\210\300\307\302\303\307\304\310\304\306\304&\"\210\300\311\302\303\311\304\312\304\306\304&\"\210\313\314!\207" [ert-set-test websocket-client-with-local-server record ert-test nil #[nil "\301\302\303\304\305\306\307&\211\205\310\311!\210\312\313!)\207" [proc start-process "websocket-testserver" "*websocket-testserver*" "python3" "testserver.py" "--log_to_stderr" "--logging=debug" sleep-for 1 websocket-functional-client-test "ws://127.0.0.1:9999"] 8] :passed websocket-client-with-remote-server #[nil "\301\302\303O!\304Y\203\305\306!\207\305\307!\207" [emacs-version string-to-number 0 2 24 websocket-functional-client-test "wss://echo.websocket.org" "ws://echo.websocket.org"] 4] websocket-server #[nil "\306\211\307\310\311\312\313\314\315\316&\317\320\313\321#\322\323!\306\324\216\325 \306\"#\326\327\325 #\"![\330W\203C\"\204C\331 !\"\332\333!\210\202$\"*\211)\204P\334 !\210*\335 \336\"\210\322\323!$\306%\337\216\325 \306\"#\326\327\325 #\"![\330W\203\206\"\204\206 \336\232\"\332\333!\210\202g\"*\211$)\204\225\334%!\210*\340\n!\210\322\323!&\306'\341\216\325 \306\"#\326\327\325 #\"![\330W\203\310\"\204\310\"\332\333!\210\202\253\"*\211&)\204\327\334'!\210)&-\207" [wstest-closed wstest-msg server-conn wstest-ws #1=#:value-643 #2=#:form-description-644 nil websocket-server 9998 :host local :on-message #[(ws frame) "\302\303 !\"\207" [ws frame websocket-send-text websocket-frame-text] 4] :on-close #[(_websocket) "\301\211\207" [wstest-closed t] 2] websocket-open "ws://localhost:9998" #[(_websocket frame) "\302!\211\207" [frame wstest-msg websocket-frame-text] 2] gensym "ert-form-evaluation-aborted-" #[nil "\302\303\304\305\257\306 !\207" [#1# #2# (should (websocket-test-wait-with-timeout 1 #3=(websocket-openp wstest-ws))) :form (let #4=((begin (current-time)) (result nil)) (while (and (< #5=(- (float-time (time-subtract (current-time) begin))) 1) . #6=((not result))) (setq result #3#) . #8=((sleep-for 0.5))) . #9=(result)) :value ert--signal-should-execution] 5] current-time float-time time-subtract 1 websocket-openp sleep-for 0.5 ert-fail websocket-send-text "你好" #[nil "\302\303\304\305\257\306 !\207" [#10=#:value-645 #11=#:form-description-646 (should (websocket-test-wait-with-timeout 1 #7=(equal wstest-msg "你好"))) :form (let #4# (while (and (< #5# 1) . #6#) (setq result #7#) . #8#) . #9#) :value ert--signal-should-execution] 5] websocket-server-close #[nil "\302\303\304\305\257\306 !\207" [#12=#:value-647 #13=#:form-description-648 (should (websocket-test-wait-with-timeout 1 wstest-closed)) :form (let #4# (while (and (< #5# 1) . #6#) (setq result wstest-closed) . #8#) . #9#) :value ert--signal-should-execution] 5] result begin #10# #11# #12# #13#] 9] provide websocket-functional-test] 10)