c265902bea
Review URL: https://chromiumcodereview.appspot.com//10836241 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10685 260f80e4-7a28-3924-810f-c04153c831b5
70 lines
1.8 KiB
Dart
70 lines
1.8 KiB
Dart
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
String getHtmlContents(String title,
|
|
String controllerScript,
|
|
String dartJsScript,
|
|
String scriptType,
|
|
String sourceScript) =>
|
|
"""
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<title> Test $title </title>
|
|
<style>
|
|
.unittest-table { font-family:monospace; border:1px; }
|
|
.unittest-pass { background: #6b3;}
|
|
.unittest-fail { background: #d55;}
|
|
.unittest-error { background: #a11;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1> Running $title </h1>
|
|
<script type="text/javascript" src="$controllerScript"></script>
|
|
<script type="$scriptType" src="$sourceScript"></script>
|
|
<script type="text/javascript" src="$dartJsScript"></script>
|
|
</body>
|
|
</html>
|
|
""";
|
|
|
|
String getHtmlLayoutContents(String scriptType, String sourceScript) =>
|
|
"""
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript">
|
|
if (navigator.webkitStartDart) navigator.webkitStartDart();
|
|
</script>
|
|
<script type="$scriptType" src="$sourceScript"></script>
|
|
</body>
|
|
</html>
|
|
""";
|
|
|
|
String wrapDartTestInLibrary(Path test) =>
|
|
"""
|
|
#library('libraryWrapper');
|
|
#source('$test');
|
|
""";
|
|
|
|
String dartTestWrapper(Path dartHome, Path library) =>
|
|
"""
|
|
#library('test');
|
|
|
|
#import('${dartHome.append('pkg/unittest/unittest.dart')}', prefix: 'unittest');
|
|
#import('${dartHome.append('pkg/unittest/html_config.dart')}',
|
|
prefix: 'config');
|
|
|
|
#import('${library}', prefix: "Test");
|
|
|
|
main() {
|
|
config.useHtmlConfiguration();
|
|
unittest.group('', Test.main);
|
|
}
|
|
""";
|
|
|