| 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. | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|  37     return null; |  37     return null; | 
|  38   } |  38   } | 
|  39   return new HtmlTestInformation(new Path(filename), |  39   return new HtmlTestInformation(new Path(filename), | 
|  40                                  annotation['expectedMessages'], |  40                                  annotation['expectedMessages'], | 
|  41                                  annotation['scripts']); |  41                                  annotation['scripts']); | 
|  42 } |  42 } | 
|  43  |  43  | 
|  44 String getContents(HtmlTestInformation info) { |  44 String getContents(HtmlTestInformation info) { | 
|  45   String contents = new File(info.filePath.toNativePath()).readAsStringSync(); |  45   String contents = new File(info.filePath.toNativePath()).readAsStringSync(); | 
|  46   return contents.replaceFirst(htmlAnnotation, ''); |  46   return contents.replaceFirst(htmlAnnotation, ''); | 
|  47 } |  47 } | 
 |  48  | 
 |  49 String makeFailingHtmlFile(String message) { | 
 |  50   return ''' | 
 |  51 <!DOCTYPE html> | 
 |  52 <html> | 
 |  53 <head> | 
 |  54   <script>window.parent.dispatchEvent(new Event('detect_errors'));</script> | 
 |  55   <title>Failing HTML test</title> | 
 |  56 </head><body> | 
 |  57   <h1>Failing HTML test</h1> | 
 |  58   $message | 
 |  59   <script> | 
 |  60     throw "HTML test failed: $message"; | 
 |  61   </script> | 
 |  62 </body> | 
 |  63 </html> | 
 |  64 '''; | 
 |  65 } | 
| OLD | NEW |