File tree Expand file tree Collapse file tree 4 files changed +56
-0
lines changed
test/sanity/worker-msgloop Expand file tree Collapse file tree 4 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < meta charset ="utf-8 ">
5
+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
6
+ < title > worker-require-module</ title >
7
+ </ head >
8
+ < body >
9
+ < script >
10
+
11
+ function out ( id , msg ) {
12
+ var h1 = document . createElement ( 'h1' ) ;
13
+ h1 . setAttribute ( 'id' , id ) ;
14
+ h1 . innerHTML = msg ;
15
+ document . body . appendChild ( h1 ) ;
16
+ }
17
+
18
+ function tryRequire ( ) {
19
+ new Worker ( 'worker.js' ) . onmessage = ( e ) => out ( 'result' , e . data ) ;
20
+ }
21
+
22
+ tryRequire ( ) ;
23
+ </ script >
24
+ </ body >
25
+ </ html >
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " worker-require-module" ,
3
+ "main" : " index.html"
4
+ }
Original file line number Diff line number Diff line change
1
+ import time
2
+ import os
3
+
4
+ from selenium import webdriver
5
+ from selenium .webdriver .chrome .options import Options
6
+ chrome_options = Options ()
7
+ chrome_options .add_argument ("nwapp=" + os .path .dirname (os .path .abspath (__file__ )))
8
+ chrome_options .add_nw_argument ("--enable-node-worker" )
9
+
10
+ driver = webdriver .Chrome (executable_path = os .environ ['CHROMEDRIVER' ], chrome_options = chrome_options )
11
+ driver .implicitly_wait (5 )
12
+ time .sleep (1 )
13
+ try :
14
+ print driver .current_url
15
+ result = driver .find_element_by_id ('result' ).get_attribute ('innerHTML' )
16
+ print result
17
+ assert ('success' in result )
18
+ finally :
19
+ driver .quit ()
Original file line number Diff line number Diff line change
1
+ try {
2
+ const dns = require ( 'dns' ) ;
3
+ dns . lookup ( 'nwjs.io' , ( ) => {
4
+ postMessage ( 'success' ) ;
5
+ } ) ;
6
+ } catch ( e ) {
7
+ postMessage ( e . message ) ;
8
+ }
You can’t perform that action at this time.
0 commit comments