| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 | 4 |
| 5 /** | 5 /** |
| 6 * Classes and methods for running HTML tests. | 6 * Classes and methods for running HTML tests. |
| 7 * | 7 * |
| 8 * HTML tests are valid HTML files whose names end in _htmltest.html, and that | 8 * HTML tests are valid HTML files whose names end in _htmltest.html, and that |
| 9 * contain annotations specifying the scripts in the test and the | 9 * contain annotations specifying the scripts in the test and the |
| 10 * messages the test should post to its window, in order to pass. | 10 * messages the test should post to its window, in order to pass. |
| 11 */ | 11 */ |
| 12 library html_test; | 12 library html_test; |
| 13 | 13 |
| 14 import "dart:convert"; | 14 import "dart:convert"; |
| 15 import "dart:io"; | 15 import "dart:io"; |
| 16 | 16 |
| 17 import "path.dart"; |
| 17 import "test_suite.dart"; | 18 import "test_suite.dart"; |
| 18 import "utils.dart"; | 19 import "utils.dart"; |
| 19 | 20 |
| 20 RegExp htmlAnnotation = | 21 RegExp htmlAnnotation = |
| 21 new RegExp("START_HTML_DART_TEST([\\s\\S]*?)END_HTML_DART_TEST"); | 22 new RegExp("START_HTML_DART_TEST([\\s\\S]*?)END_HTML_DART_TEST"); |
| 22 | 23 |
| 23 HtmlTestInformation getInformation(String filename) { | 24 HtmlTestInformation getInformation(String filename) { |
| 24 if (!filename.endsWith("_htmltest.html")) { | 25 if (!filename.endsWith("_htmltest.html")) { |
| 25 DebugLogger.warning("File $filename is not an HTML test." | 26 DebugLogger.warning("File $filename is not an HTML test." |
| 26 " Should end in _htmltest.html."); | 27 " Should end in _htmltest.html."); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 </head><body> | 68 </head><body> |
| 68 <h1>Failing HTML test</h1> | 69 <h1>Failing HTML test</h1> |
| 69 $message | 70 $message |
| 70 <script> | 71 <script> |
| 71 throw "HTML test failed: $message"; | 72 throw "HTML test failed: $message"; |
| 72 </script> | 73 </script> |
| 73 </body> | 74 </body> |
| 74 </html> | 75 </html> |
| 75 '''; | 76 '''; |
| 76 } | 77 } |
| OLD | NEW |