OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 library browser; | 4 library browser; |
5 | 5 |
6 import "dart:async"; | 6 import "dart:async"; |
7 import "dart:convert" show LineSplitter, UTF8, JSON; | 7 import "dart:convert" show LineSplitter, UTF8, JSON; |
8 import "dart:core"; | 8 import "dart:core"; |
9 import "dart:io"; | 9 import "dart:io"; |
10 | 10 |
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1455 "produce driver url"); | 1455 "produce driver url"); |
1456 exit(1); | 1456 exit(1); |
1457 // This should never happen - exit immediately; | 1457 // This should never happen - exit immediately; |
1458 } | 1458 } |
1459 var port = configuration['_servers_'].port; | 1459 var port = configuration['_servers_'].port; |
1460 return "http://$localIp:$port/driver/$browserId"; | 1460 return "http://$localIp:$port/driver/$browserId"; |
1461 } | 1461 } |
1462 | 1462 |
1463 | 1463 |
1464 String getDriverPage(String browserId) { | 1464 String getDriverPage(String browserId) { |
1465 | |
1466 // DO NOT SUBMIT: Should only happen when starting Safari, and ideally be | |
ahe
2016/04/08 12:56:53
Bill, I hope you have an idea for how to integrate
| |
1467 // async. | |
1468 Process.runSync( | |
1469 "/usr/bin/osascript", | |
1470 ['-e', 'tell application "Safari" to activate']); | |
1471 | |
1465 var errorReportingUrl = | 1472 var errorReportingUrl = |
1466 "http://$localIp:${errorReportingServer.port}/$browserId"; | 1473 "http://$localIp:${errorReportingServer.port}/$browserId"; |
1467 String driverContent = """ | 1474 String driverContent = """ |
1468 <!DOCTYPE html><html> | 1475 <!DOCTYPE html><html> |
1469 <head> | 1476 <head> |
1470 <style> | |
1471 body { | |
1472 margin: 0; | |
1473 } | |
1474 .box { | |
1475 overflow: hidden; | |
1476 overflow-y: auto; | |
1477 position: absolute; | |
1478 left: 0; | |
1479 right: 0; | |
1480 } | |
1481 .controller.box { | |
1482 height: 75px; | |
1483 top: 0; | |
1484 } | |
1485 .test.box { | |
1486 top: 75px; | |
1487 bottom: 0; | |
1488 } | |
1489 </style> | |
1490 <title>Driving page</title> | 1477 <title>Driving page</title> |
1491 <script type='text/javascript'> | 1478 <script type='text/javascript'> |
1492 var STATUS_UPDATE_INTERVAL = 10000; | 1479 var STATUS_UPDATE_INTERVAL = 10000; |
1493 | 1480 |
1494 function startTesting() { | 1481 function startTesting() { |
1495 var number_of_tests = 0; | 1482 var number_of_tests = 0; |
1496 var current_id; | 1483 var current_id; |
1497 var next_id; | 1484 var next_id; |
1498 | 1485 |
1499 // Has the test in the current iframe reported that it is done? | 1486 // Has the test in the current iframe reported that it is done? |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1610 if (use_iframe) { | 1597 if (use_iframe) { |
1611 if (html_test) { | 1598 if (html_test) { |
1612 window.addEventListener('detect_errors', setChildHandlers, false); | 1599 window.addEventListener('detect_errors', setChildHandlers, false); |
1613 embedded_iframe.onload = checkChildHandlersInstalled; | 1600 embedded_iframe.onload = checkChildHandlersInstalled; |
1614 } else { | 1601 } else { |
1615 embedded_iframe.onload = null; | 1602 embedded_iframe.onload = null; |
1616 } | 1603 } |
1617 embedded_iframe_div.removeChild(embedded_iframe); | 1604 embedded_iframe_div.removeChild(embedded_iframe); |
1618 embedded_iframe = document.createElement('iframe'); | 1605 embedded_iframe = document.createElement('iframe'); |
1619 embedded_iframe.id = "embedded_iframe"; | 1606 embedded_iframe.id = "embedded_iframe"; |
1620 embedded_iframe.style="width:100%;height:100%"; | 1607 embedded_iframe.width='800px'; |
1608 embedded_iframe.height='600px'; | |
1621 embedded_iframe_div.appendChild(embedded_iframe); | 1609 embedded_iframe_div.appendChild(embedded_iframe); |
1622 embedded_iframe.src = url; | 1610 embedded_iframe.src = url; |
1623 } else { | 1611 } else { |
1624 if (typeof testing_window != 'undefined') { | 1612 if (typeof testing_window != 'undefined') { |
1625 testing_window.close(); | 1613 testing_window.close(); |
1626 } | 1614 } |
1627 testing_window = window.open(url); | 1615 testing_window = window.open(url); |
1628 } | 1616 } |
1629 test_started = false; | 1617 test_started = false; |
1630 test_completed = false; | 1618 test_completed = false; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1787 getNextTask(); | 1775 getNextTask(); |
1788 } | 1776 } |
1789 </script> | 1777 </script> |
1790 </head> | 1778 </head> |
1791 <body onload="startTesting()"> | 1779 <body onload="startTesting()"> |
1792 <div class="controller box"> | 1780 <div class="controller box"> |
1793 Dart test driver, number of tests: <span id="number"></span><br> | 1781 Dart test driver, number of tests: <span id="number"></span><br> |
1794 Currently executing: <span id="currently_executing"></span><br> | 1782 Currently executing: <span id="currently_executing"></span><br> |
1795 Unhandled error: <span id="unhandled_error"></span> | 1783 Unhandled error: <span id="unhandled_error"></span> |
1796 </div> | 1784 </div> |
1785 <div> | |
1786 Please keep this window visible at all times. Some browsers, Safari, in | |
1787 particular, may pause JavaScript when not visible to conserve power | |
1788 consumption and CPU resources. | |
1789 </div> | |
1797 <div id="embedded_iframe_div" class="test box"> | 1790 <div id="embedded_iframe_div" class="test box"> |
1798 <iframe style="width:100%;height:100%;" id="embedded_iframe"></iframe> | 1791 <iframe id="embedded_iframe"></iframe> |
1799 </div> | 1792 </div> |
1800 </body> | 1793 </body> |
1801 </html> | 1794 </html> |
1802 """; | 1795 """; |
1803 return driverContent; | 1796 return driverContent; |
1804 } | 1797 } |
1805 } | 1798 } |
OLD | NEW |