| Index: tests/compiler/dart2js/sourcemaps/sourcemap_html_templates.dart
|
| diff --git a/tests/compiler/dart2js/sourcemaps/sourcemap_html_templates.dart b/tests/compiler/dart2js/sourcemaps/sourcemap_html_templates.dart
|
| index 573b90280646c338752a2f215d28c98d0661d68b..f4b0f1ba3b9ce44749eb07302cd7f2389d7b83e3 100644
|
| --- a/tests/compiler/dart2js/sourcemaps/sourcemap_html_templates.dart
|
| +++ b/tests/compiler/dart2js/sourcemaps/sourcemap_html_templates.dart
|
| @@ -8,6 +8,112 @@ library sourcemap.html.templates;
|
|
|
| import 'dart:io';
|
|
|
| +abstract class Configurations {
|
| + Iterable<String> get configs;
|
| + Iterable<String> get files;
|
| + String getPath(String config, String file);
|
| +}
|
| +
|
| +void outputMultiConfigs(Uri uri,
|
| + Configurations configurations) {
|
| + StringBuffer sb = new StringBuffer();
|
| + String defaultConfig = configurations.configs.first;
|
| + String defaultFile = configurations.files.first;
|
| + sb.write('''
|
| +<html>
|
| +<head>
|
| +<style>
|
| +.button {
|
| + cursor: pointer;
|
| + padding: 10px;
|
| + display: inline;
|
| +}
|
| +iframe {
|
| + border: 0px;
|
| +}
|
| +</style>
|
| +</head>
|
| +<body style="margin:0px;">
|
| +<script>
|
| +function setAll(name, property, value) {
|
| + var elements = document.getElementsByName(name);
|
| + for (var i = 0; i < elements.length; i++) {
|
| + elements[i].style[property] = value;
|
| + }
|
| +}
|
| +
|
| +var current_config;
|
| +var current_file;
|
| +
|
| +function setConfig(value) {
|
| + var property = 'text-decoration';
|
| + var onValue = 'underline';
|
| + var offValue = 'none';
|
| + if (current_config != value) {
|
| + setAll('config:' + current_config, property, offValue);
|
| + setAll('src:' + current_config + ':' + current_file, 'display', 'none');
|
| + current_config = value;
|
| + setAll('config:' + current_config, property, onValue);
|
| + setAll('src:' + current_config + ':' + current_file, 'display', 'block');
|
| + }
|
| +}
|
| +
|
| +function setFile(value) {
|
| + var property = 'text-decoration';
|
| + var onValue = 'underline';
|
| + var offValue = 'none';
|
| + if (current_file != value) {
|
| + setAll('file:' + current_file, property, offValue);
|
| + setAll('src:' + current_config + ':' + current_file, 'display', 'none');
|
| + current_file = value;
|
| + setAll('file:' + current_file, property, onValue);
|
| + setAll('src:' + current_config + ':' + current_file, 'display', 'block');
|
| + }
|
| +}
|
| +</script>
|
| +''');
|
| + for (String config in configurations.configs) {
|
| + for (String file in configurations.files) {
|
| + String uri = configurations.getPath(config, file);
|
| + sb.write('''
|
| +<div name="src:$config:$file"
|
| + style="width:100%;position:absolute;display:none;">
|
| + <iframe src="$uri" style="width:100%;height:100%;">
|
| + </iframe>
|
| +</div>
|
| +''');
|
| + }
|
| + }
|
| + sb.write('''
|
| +<div style="right:0px;height:30px;background-color:#E0E0E0;position:fixed;">
|
| + file:
|
| +''');
|
| + for (String file in configurations.files) {
|
| + sb.write('''
|
| + <h3 class="button" name="file:$file"
|
| + onclick="setFile('$file');">$file</h3>
|
| +''');
|
| + }
|
| + sb.write('''
|
| + config:
|
| +''');
|
| + for (String config in configurations.configs) {
|
| + sb.write('''
|
| + <h3 class="button" name="config:$config"
|
| + onclick="setConfig('$config');">$config</h3>
|
| +''');
|
| + }
|
| + sb.write('''
|
| +</div>
|
| +<script>
|
| +setConfig('$defaultConfig');
|
| +setFile('$defaultFile');
|
| +</script>
|
| +</body>
|
| +</html>''');
|
| + output(uri, sb.toString());
|
| +}
|
| +
|
| /// Outputs JavaScript/Dart source mapping traces into [uri].
|
| void outputJsDartTrace(
|
| Uri uri,
|
|
|