Files
sdk/tools/testing/dart/browser_test.dart
T
gram@google.com 5afecf5f67 Changes to how we handle fancy stacks:
- in the base config they are disabled
- in htmnl config they are enabled unless a certain meta tag is present in the
  page.
- in vm config they are enabled unless a --no-fancy-stacks flag is in the
  Options.

The test runner adds a fancy_stacks flag that can be used to control this
behavior, but by default turns off fancy stacks for all tests.

There were a couple of test runner tests that were affected and have kludgy
fixes where I strip out the new argument from Options first.

This has passed a baseline set of tests; I'm still running a more comprehensive
set.

R=kustermann@google.com, nweiz@google.com

Review URL: https://codereview.chromium.org//22859009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26560 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-22 21:47:51 +00:00

80 lines
2.2 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.
part of test_suite;
String getHtmlContents(String title,
String scriptType,
Path sourceScript) =>
"""
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="dart.unittest" content="full-stack-traces">
<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="/root_dart/pkg/unittest/lib/test_controller.js">
</script>
<script type="$scriptType" src="$sourceScript" onerror="externalError(null)"
defer>
</script>
<script type="text/javascript"
src="/root_dart/pkg/browser/lib/dart.js"></script>
<script type="text/javascript"
src="/root_dart/pkg/browser/lib/interop.js"></script>
</body>
</html>
""";
String getHtmlLayoutContents(String scriptType,
Path sourceScript) =>
"""
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="dart.unittest" content="full-stack-traces">
</head>
<body>
<script type="text/javascript">
if (navigator.webkitStartDart) navigator.webkitStartDart();
</script>
<script type="$scriptType" src="$sourceScript" defer></script>
</body>
</html>
""";
String dartTestWrapper(bool usePackageImport, String libraryPathComponent) {
// Tests inside "pkg" import unittest using "package:". All others use a
// relative path. The imports need to agree, so use a matching form here.
var unitTest;
if (usePackageImport) {
unitTest = 'package:unittest';
} else {
unitTest = '/root_dart/pkg/unittest/lib';
}
return """
library test;
import '$unitTest/unittest.dart' as unittest;
import '$unitTest/html_config.dart' as config;
import '$libraryPathComponent' as Test;
main() {
config.useHtmlConfiguration();
unittest.group('', Test.main);
}
""";
}