File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ use crate :: helper;
2
+ use core:: time:: Duration ;
3
+ use std:: thread;
4
+ use thirtyfour:: prelude:: * ;
5
+ use tokio:: runtime:: Runtime ;
6
+ use tracing:: * ;
7
+
8
+ pub fn start_check_tasks_on_webrtc_reconnects ( ) {
9
+ let mut counter = 0 ;
10
+ thread:: spawn ( move || {
11
+ let rt = Runtime :: new ( ) . unwrap ( ) ;
12
+ rt. block_on ( async move {
13
+ info ! ( "Started webrtc test.." ) ;
14
+ let mut caps = DesiredCapabilities :: chrome ( ) ;
15
+ let _ = caps. set_headless ( ) ;
16
+ let driver = WebDriver :: new ( "http://localhost:9515" , caps)
17
+ . await
18
+ . expect ( "Failed to create web driver." ) ;
19
+ driver
20
+ . goto ( "http://0.0.0.0:6020/webrtc/index.html" )
21
+ . await
22
+ . expect ( "Failed to connect to local webrtc page." ) ;
23
+ loop {
24
+ for button in [ "add-consumer" , "add-session" , "remove-all-consumers" ] {
25
+ thread:: sleep ( Duration :: from_secs ( 3 ) ) ;
26
+ driver
27
+ . find ( By :: Id ( button) )
28
+ . await
29
+ . unwrap ( )
30
+ . click ( )
31
+ . await
32
+ . unwrap ( ) ;
33
+ }
34
+ counter += 1 ;
35
+ info ! ( "Restarted webrtc {} times" , counter) ;
36
+ if helper:: threads:: process_task_counter ( ) > 100 {
37
+ error ! ( "Thead leak detected!" ) ;
38
+ std:: process:: exit ( -1 ) ;
39
+ }
40
+ }
41
+ } ) ;
42
+ error ! ( "Webrtc test failed internally." ) ;
43
+ std:: process:: exit ( -1 ) ;
44
+ } ) ;
45
+ }
Original file line number Diff line number Diff line change 1
1
#[ macro_use]
2
+ pub mod develop;
2
3
pub mod macros;
3
4
pub mod threads;
You can’t perform that action at this time.
0 commit comments