Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(493)

Unified Diff: tools/testing/dart/html_test.dart

Issue 841193003: cleanup to tools/testing/dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: one last bit Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/testing/dart/drt_updater.dart ('k') | tools/testing/dart/http_server.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/html_test.dart
diff --git a/tools/testing/dart/html_test.dart b/tools/testing/dart/html_test.dart
deleted file mode 100644
index 0f69eed460f813b130177bf2cea37df5bce32341..0000000000000000000000000000000000000000
--- a/tools/testing/dart/html_test.dart
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2014, 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.
-
-/**
- * Classes and methods for running HTML tests.
- *
- * HTML tests are valid HTML files whose names end in _htmltest.html, and that
- * contain annotations specifying the scripts in the test and the
- * messages the test should post to its window, in order to pass.
- */
-library html_test;
-
-import "dart:convert";
-import "dart:io";
-
-import "path.dart";
-import "test_suite.dart";
-import "utils.dart";
-
-RegExp htmlAnnotation =
- new RegExp("START_HTML_DART_TEST([\\s\\S]*?)END_HTML_DART_TEST");
-
-HtmlTestInformation getInformation(String filename) {
- if (!filename.endsWith("_htmltest.html")) {
- DebugLogger.warning("File $filename is not an HTML test."
- " Should end in _htmltest.html.");
- return null;
- }
- String contents = new File(filename).readAsStringSync();
- var match = htmlAnnotation.firstMatch(contents);
- if (match == null) return null;
- var annotation = JSON.decode(match[1]);
- if (annotation is! Map || annotation['expectedMessages'] is! List ||
- annotation['scripts'] is! List) {
- DebugLogger.warning("File $filename does not have expected annotation."
- " Should have {'scripts':[...], 'expectedMessages':[...]}");
- return null;
- }
- return new HtmlTestInformation(new Path(filename),
- annotation['expectedMessages'],
- annotation['scripts']);
-}
-
-String getContents(HtmlTestInformation info, bool compileToJS) {
- String contents = new File(info.filePath.toNativePath()).readAsStringSync();
- contents = contents.replaceFirst(htmlAnnotation, '');
- if (compileToJS) {
- for (String script in info.scripts) {
- if (dartExtension.hasMatch(script)) {
- String jsScript = script.replaceFirst(dartExtension, '.js');
- String tag = '<script src="$script" type="application/dart">';
- String jsTag = '<script src="$jsScript">';
- contents = contents.replaceAll(tag, jsTag);
- }
- }
- }
- return contents;
-}
-
-String makeFailingHtmlFile(String message) {
- return '''
-<!DOCTYPE html>
-<html>
-<head>
- <script>window.parent.dispatchEvent(new Event('detect_errors'));</script>
- <title>Failing HTML test</title>
-</head><body>
- <h1>Failing HTML test</h1>
- $message
- <script>
- throw "HTML test failed: $message";
- </script>
-</body>
-</html>
-''';
-}
« no previous file with comments | « tools/testing/dart/drt_updater.dart ('k') | tools/testing/dart/http_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698