Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit 0453a23

Browse files
committed
Merge pull request #110 from kaixinjxq/master
Add the 'Run in Web Test Client app' pupup.
2 parents 2e5d315 + fab12f3 commit 0453a23

File tree

3 files changed

+89
-3
lines changed

3 files changed

+89
-3
lines changed

wts/runner/index.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@
1818
<div class="container" style="display:none;" id="container">
1919

2020
<div id="testControl" class="panel hide_panel_border">
21-
<div id="test_select_div">
21+
22+
<div id="popup" class="popup">
23+
<span class="link_popup">
24+
Run in Web Test Client app
25+
</span>
26+
<span class="glyphicon glyphicon-remove cancel_popup"></span>
27+
</div>
28+
29+
<div id="test_select_div" class="">
2230
<div id="spec_tabs">
2331
<ul class="my_nav my_nav-tabs">
2432
<li id="li_select_test_specs" class="my_active tab_li">

wts/runner/runner.css

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ body {
215215

216216
.navbar{
217217
margin-bottom:0px;
218+
border:0px;
218219
}
219220

220221
.navbar-brand{
@@ -1073,4 +1074,36 @@ li.specname label{
10731074
padding:.0625em;
10741075
-webkit-border-radius:2.25em;
10751076
border-radius:2.25em;
1076-
}
1077+
}
1078+
1079+
.popup {
1080+
position: fixed;
1081+
top: 50px;
1082+
left: 0;
1083+
right: 0;
1084+
display: block;
1085+
background: #444;
1086+
color: #fff;
1087+
height: 60px;
1088+
padding-top: 20px;
1089+
display: none;
1090+
z-index: 1001;
1091+
}
1092+
.margin_top_50{
1093+
margin-top: 50px;
1094+
}
1095+
1096+
.cancel_popup{
1097+
float:right;
1098+
padding-right:15px;
1099+
padding-top:-15px;
1100+
cursor: pointer;
1101+
}
1102+
1103+
.link_popup{
1104+
background-color:#EC543B;
1105+
padding:7px;
1106+
color:#fff;
1107+
margin-left:40px;
1108+
cursor: pointer;
1109+
}

wts/runner/runner.js

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ Manifest.prototype = {
2424
document.getElementById("over").style.display = "none";
2525
document.getElementById("layout").style.display = "none";
2626
document.getElementById("container").style.display = "block";
27+
var popup_text = navigator.userAgent;
28+
if (popup_text.indexOf("Android") != -1 && popup_text.indexOf("Crosswalk") == -1){
29+
var cookie_item = get_popup_cookie("wts_client");
30+
if (cookie_item == ""){
31+
set_popup_cookie("wts_client", "yes", 30);
32+
document.getElementById("popup").style.display = "block";
33+
document.getElementById("test_select_div").classList.add("margin_top_50");
34+
}
35+
}
2736
this.data = JSON.parse(xhr.responseText);
2837
loaded_callback();
2938
}.bind(this);
@@ -720,7 +729,21 @@ function TestControl(elem, runner) {
720729
this.advanced_link = this.elem.querySelector(".advanced_link");
721730
this.advanced_div = this.elem.querySelector(".advanced_div");
722731
this.start_error = this.elem.querySelector(".start_error");
723-
this.set_start();
732+
this.cancel_link = this.elem.querySelector("span.cancel_popup");
733+
this.spec_link = this.elem.querySelector("span.link_popup");
734+
this.popup_div = this.elem.querySelector("div.popup");
735+
this.test_select_div = this.elem.querySelector("div#test_select_div");
736+
737+
this.set_start();
738+
739+
this.cancel_link.onclick = function(){
740+
this.popup_div.style.display = "none";
741+
this.test_select_div.classList.remove("margin_top_50");
742+
}.bind(this);
743+
744+
this.spec_link.onclick = function(){
745+
window.location.href = "https://github.com/crosswalk-project/web-testing-service/wiki#download";
746+
}.bind(this);
724747

725748
this.select_tab.onclick = function(){
726749
this.select_select_tab();
@@ -803,6 +826,8 @@ TestControl.prototype = {
803826
this.start_li.classList.remove("width_100");
804827
this.start_li.classList.add("width_49_75");
805828
this.pause_button.classList.remove("button_hidden");
829+
this.popup_div.style.display = "none";
830+
this.test_select_div.classList.remove("margin_top_50");
806831
window.scrollTo(0,0);
807832
var run_mode = "window";
808833
if (this.iframe_checkbox.checked) {
@@ -1348,6 +1373,26 @@ Runner.prototype = {
13481373

13491374
};
13501375

1376+
function set_popup_cookie(cookie_name,cookie_value,cookie_exdays) {
1377+
var d = new Date();
1378+
d.setTime(d.getTime() + (cookie_exdays*24*60*60*1000));
1379+
var expires = "expires="+d.toUTCString();
1380+
document.cookie = cookie_name + "=" + cookie_value + "; " + expires;
1381+
}
1382+
1383+
function get_popup_cookie(cname) {
1384+
var name = cname + "=";
1385+
var ca = document.cookie.split(';');
1386+
for(var i=0; i<ca.length; i++) {
1387+
var c = ca[i];
1388+
while (c.charAt(0)==' ') c = c.substring(1);
1389+
if (c.indexOf(name) == 0) {
1390+
return c.substring(name.length, c.length);
1391+
}
1392+
}
1393+
return "";
1394+
}
1395+
13511396
function parseOptions() {
13521397
var options = {
13531398
test_types: ["testharness", "reftest", "manual"]

0 commit comments

Comments
 (0)