| 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; | 7 import "dart:convert" show LineSplitter, UTF8; |
| 8 import "dart:core"; | 8 import "dart:core"; |
| 9 import "dart:io"; | 9 import "dart:io"; |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 throw "Non supported browser"; | 76 throw "Non supported browser"; |
| 77 } | 77 } |
| 78 browser._binary = executablePath; | 78 browser._binary = executablePath; |
| 79 return browser; | 79 return browser; |
| 80 } | 80 } |
| 81 | 81 |
| 82 static const List<String> SUPPORTED_BROWSERS = | 82 static const List<String> SUPPORTED_BROWSERS = |
| 83 const ['safari', 'ff', 'firefox', 'chrome', 'ie9', 'ie10', | 83 const ['safari', 'ff', 'firefox', 'chrome', 'ie9', 'ie10', |
| 84 'ie11', 'dartium']; | 84 'ie11', 'dartium']; |
| 85 | 85 |
| 86 static const List<String> BROWSERS_WITH_WINDOW_SUPPORT = const []; | 86 static const List<String> BROWSERS_WITH_WINDOW_SUPPORT = const ['ie11']; |
| 87 | 87 |
| 88 // TODO(kustermann): add standard support for chrome on android | 88 // TODO(kustermann): add standard support for chrome on android |
| 89 static bool supportedBrowser(String name) { | 89 static bool supportedBrowser(String name) { |
| 90 return SUPPORTED_BROWSERS.contains(name); | 90 return SUPPORTED_BROWSERS.contains(name); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void _logEvent(String event) { | 93 void _logEvent(String event) { |
| 94 String toLog = "$this ($id) - $event \n"; | 94 String toLog = "$this ($id) - $event \n"; |
| 95 if (debugPrint) print("usageLog: $toLog"); | 95 if (debugPrint) print("usageLog: $toLog"); |
| 96 if (logger != null) logger(toLog); | 96 if (logger != null) logger(toLog); |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1367 // negative value. | 1367 // negative value. |
| 1368 contactBrowserController( | 1368 contactBrowserController( |
| 1369 'GET', '$nextTestPath/$browserId', newTaskHandler, "", false); | 1369 'GET', '$nextTestPath/$browserId', newTaskHandler, "", false); |
| 1370 } | 1370 } |
| 1371 | 1371 |
| 1372 function run(url) { | 1372 function run(url) { |
| 1373 number_of_tests++; | 1373 number_of_tests++; |
| 1374 number_div.innerHTML = number_of_tests; | 1374 number_div.innerHTML = number_of_tests; |
| 1375 executing_div.innerHTML = url; | 1375 executing_div.innerHTML = url; |
| 1376 if (use_iframe) { | 1376 if (use_iframe) { |
| 1377 var embedded_iframe = document.getElementById('embedded_iframe'); | |
| 1378 embedded_iframe.parentNode.removeChild(embedded_iframe); | |
| 1379 | |
| 1380 embedded_iframe = document.createElement('iframe'); | |
| 1381 embedded_iframe.id = 'embedded_iframe'; | |
| 1382 document.body.appendChild(embedded_iframe); | |
| 1383 embedded_iframe.src = url; | 1377 embedded_iframe.src = url; |
| 1384 } else { | 1378 } else { |
| 1385 if (typeof testing_window != 'undefined') { | 1379 if (typeof testing_window != 'undefined') { |
| 1386 testing_window.close(); | 1380 testing_window.close(); |
| 1387 } | 1381 } |
| 1388 testing_window = window.open(url); | 1382 testing_window = window.open(url); |
| 1389 } | 1383 } |
| 1390 } | 1384 } |
| 1391 | 1385 |
| 1392 window.onerror = function (message, url, lineNumber) { | 1386 window.onerror = function (message, url, lineNumber) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1499 Dart test driver, number of tests: <div id="number"></div><br> | 1493 Dart test driver, number of tests: <div id="number"></div><br> |
| 1500 Currently executing: <div id="currently_executing"></div><br> | 1494 Currently executing: <div id="currently_executing"></div><br> |
| 1501 Unhandled error: <div id="unhandled_error"></div> | 1495 Unhandled error: <div id="unhandled_error"></div> |
| 1502 <iframe id="embedded_iframe"></iframe> | 1496 <iframe id="embedded_iframe"></iframe> |
| 1503 </body> | 1497 </body> |
| 1504 </html> | 1498 </html> |
| 1505 """; | 1499 """; |
| 1506 return driverContent; | 1500 return driverContent; |
| 1507 } | 1501 } |
| 1508 } | 1502 } |
| OLD | NEW |