Skip to content

Commit 9aef97f

Browse files
wanghongjuanrogerwang
authored andcommitted
[test] Add test for issue6171
- Add test for issue nwjs#6171 - This case is failed on failed version v0.26.0-beta1, pass on fixed version 0.27.4
1 parent b13e068 commit 9aef97f

File tree

7 files changed

+282
-0
lines changed

7 files changed

+282
-0
lines changed
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
2+
/* Browser reset code - Yahoo */
3+
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {
4+
margin:0;
5+
padding:0;
6+
}
7+
table {
8+
border-collapse:collapse;
9+
border-spacing:0;
10+
}
11+
fieldset,img {
12+
border:0;
13+
}
14+
address,caption,cite,code,dfn,em,strong,th,var {
15+
font-style:normal;
16+
font-weight:normal;
17+
}
18+
ol,ul {
19+
list-style:none;
20+
}
21+
caption,th {
22+
text-align:left;
23+
}
24+
h1,h2,h3,h4,h5,h6 {
25+
font-size:100%;
26+
font-weight:normal;
27+
}
28+
q:before,q:after {
29+
content:'';
30+
}
31+
abbr,acronym { border:0;
32+
}
33+
34+
/* End of Browser Reset code */
35+
36+
37+
/* App Main Window style */
38+
39+
body {
40+
background-color: transparent;
41+
-webkit-user-select: none;
42+
-webkit-app-region: no-drag;
43+
}
44+
45+
#content {
46+
position: absolute;
47+
display: block;
48+
top: 40px;
49+
width: 99%;
50+
height: 350px;
51+
margin-left: auto;
52+
margin-right: auto;
53+
text-align: center;
54+
border: 1px solid gray;
55+
border-radius: 10px;
56+
background-color: #006400;
57+
-webkit-app-region: drag;
58+
-webkit-user-select: auto;
59+
}
60+
61+
#fire {
62+
position: relative;
63+
display: block;
64+
top: 40px;
65+
width: 150px;
66+
height: 150px;
67+
margin-left: auto;
68+
margin-right: auto;
69+
text-align: center;
70+
}
71+
72+
h1 {
73+
position: absolute;
74+
display: block;
75+
width: 100%;
76+
font-family: "Arial Rounded MT Bold";
77+
font-size: 2.0em;
78+
top: 10px;
79+
margin-left: auto;
80+
margin-right: auto;
81+
text-align: center;
82+
color: #022c55;
83+
}
84+
85+
#versions {
86+
position: absolute;
87+
display: block;
88+
top: 20px;
89+
margin-left: 20px;
90+
width: 170px;
91+
padding: 5px;
92+
background-color: #585f6d;
93+
color: #021d38;
94+
font-size: 0.6em;
95+
border: 1px solid gray;
96+
border-radius: 8px;
97+
overflow: hidden;
98+
}
99+
100+
101+
102+
103+
104+
Loading
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<!-- Styles -->
5+
<link rel="stylesheet" type="text/css" media="screen, projection" href="css/pdftest.css" />
6+
<style>
7+
body {
8+
width: 100%;
9+
height: 100%;
10+
background-color:#000;
11+
}
12+
body {
13+
margin: 0;
14+
padding: 0;
15+
overflow: scroll;
16+
position: relative;
17+
}
18+
webview {
19+
position: relative;
20+
display: block;
21+
max-width: 190px;
22+
max-height: 100px;
23+
margin-left: auto;
24+
margin-right: auto;
25+
text-align: center;
26+
}
27+
.wbv {
28+
}
29+
30+
li {
31+
display: block;
32+
border: 1px solid gray;
33+
border-radius: 7px;
34+
}
35+
td {
36+
margin-left: auto;
37+
margin-right: auto;
38+
text-align: center;
39+
}
40+
</style>
41+
<script src="vendor/jquery.min.js"></script>
42+
</head>
43+
<body>
44+
<div id="header" style="position: fixed; background-color: #000000; height: 80px; width: 100%; z-index: 100;">
45+
<div id="versions" style="position: fixed;">
46+
NWjs version - <script>document.write(process.versions['nw']);</script><br />
47+
IO.js/node.js version - <script>document.write(process.versions['node']);</script><br />
48+
Chromium version - <script>document.write(process.versions['chromium']);</script><br />
49+
</div>
50+
<img src="hornybsd.png" style="position: fixed; top: 20px; right: 30px; width: 48px; height: 48px;" alt="hornydevil" />
51+
</div>
52+
<div id="container" style=" z-index: 99;">
53+
<ul id="ul" style="position: absolute; top: 90px; left: 30px; width: 90%; margin-left: auto; margin-right: auto; text-align: center;">
54+
55+
<br />
56+
<br />
57+
<li style="left: 10px; padding: 10px; width: 100%;">
58+
<table style="border: 1px solid gray; width: 99%; border-collapse: none;">
59+
<tr>
60+
<td style="border: 1px solid orange; width: 25%;">
61+
<h2 style="color: red;">Flash - webview tag<h2>
62+
<webview partition="trusted" src="test.swf" class="wbv"></webview>
63+
</td>
64+
</tr>
65+
</table>
66+
</li>
67+
<br />
68+
<li style="left: 10px; padding: 10px; width: 100%;">
69+
<table style="border: 1px solid gray; width: 99%; border-collapse: none;">
70+
<tr>
71+
<td style="border: 1px solid orange; width: 33%;">
72+
<h2 style="color: red;">PDF - webview tag<h2>
73+
<webview partition="trusted" src="test.pdf" class="wbv"></webview>
74+
</td>
75+
<!-- <td style="border: 1px solid orange; width: 33%;">
76+
<h2 style="color: red;">PDF - embed tag<h2>
77+
<embed src="test.pdf" style="max-width: 190px; max-height: 100px;" />
78+
</td> -->
79+
<td style="border: 1px solid orange; width: 33%;">
80+
<h2 style="color: red;">PDF - object tag<h2>
81+
<object style="color: blue; max-width: 190px; max-height: 100px;" data="test.pdf">Alternative Content Here (gifs etc)</object>
82+
</td>
83+
</tr>
84+
</table>
85+
</li>
86+
<br />
87+
<li style="left: 10px; padding: 10px; width: 100%;">
88+
<table style="border: 1px solid gray; width: 99%; border-collapse: none;">
89+
<tr>
90+
<td style="border: 1px solid orange; width: 25%;">
91+
<h2 style="color: red;">Flash - webview tag<h2>
92+
<webview partition="trusted" src="test.swf" class="wbv"></webview>
93+
</td>
94+
</tr>
95+
</table>
96+
</li>
97+
<br />
98+
<br />
99+
</ul>
100+
</div>
101+
102+
<script type="text/javascript">
103+
// var wbv = document.getElementById('wbv');
104+
// console.log(wbv);
105+
// var wbv2 = document.getElementById('wbv2');
106+
// console.log(wbv2);
107+
var webview = document.getElementById('wbv');
108+
//webview.addEventListener('permissionrequest', function (e) {
109+
//console.log("webview"+objCount+": permission - "+e.permission);
110+
111+
// if (e.permission === 'loadplugin') {
112+
// if(userSession.allowPlugins) {
113+
// e.request.allow();
114+
// } else {
115+
// // e.request.deny();
116+
// }
117+
// }
118+
// if (e.permission === 'download') {
119+
// e.request.allow();
120+
// }
121+
// // media
122+
// if (e.permission === 'media') {
123+
// e.request.allow();
124+
// }
125+
// if (e.permission === 'geolocation') {
126+
// e.request.deny();
127+
// }
128+
//});
129+
</script>
130+
<br />
131+
<br />
132+
133+
134+
135+
</body>
136+
</html>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "PDFTest",
3+
"version": "1.0.0",
4+
"main": "index.html",
5+
"window": {
6+
"height": 900,
7+
"width": 1200,
8+
"resizable": true
9+
},
10+
"webview": {
11+
"partitions": [
12+
{
13+
"name": "trusted",
14+
"accessible_resources": [ "<all_urls>" ]
15+
}
16+
]
17+
},
18+
"chromium-args": "--enable-logging --v=1",
19+
"webkit": {
20+
"plugin": true
21+
}
22+
}
281 KB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
9+
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options)
10+
driver.implicitly_wait(2)
11+
try:
12+
print driver.current_url
13+
print 'waiting for crash'
14+
time.sleep(5)
15+
result = driver.find_element_by_id('versions').get_attribute('innerHTML')
16+
#print result
17+
assert('NWjs version' in result)
18+
print 'There is no crash'
19+
finally:
20+
driver.quit()
148 KB
Binary file not shown.

0 commit comments

Comments
 (0)