| Index: LayoutTests/dart/Multiscript.html
 | 
| diff --git a/LayoutTests/dart/Multiscript.html b/LayoutTests/dart/Multiscript.html
 | 
| new file mode 100644
 | 
| index 0000000000000000000000000000000000000000..c4df14cbbc6f0b6f9470818b0a58626b23961143
 | 
| --- /dev/null
 | 
| +++ b/LayoutTests/dart/Multiscript.html
 | 
| @@ -0,0 +1,113 @@
 | 
| +<html>
 | 
| +<head>
 | 
| +<script type="application/javascript" src="../../../../dart/pkg/unittest/lib/test_controller.js"></script>
 | 
| +<script type="application/javascript">
 | 
| +var sJs = 0;
 | 
| +var callbacks = [];
 | 
| +var numCallbacks = 0;
 | 
| +// Trivial method to run all 4 callbacks in order once they are all
 | 
| +// registered.
 | 
| +function registerCallback(index, callback) {
 | 
| +  callbacks[index] = callback;
 | 
| +  numCallbacks++;
 | 
| +  if (numCallbacks == 4) {
 | 
| +    for (var i = 0; i < numCallbacks; i++) {
 | 
| +      callbacks[i]();
 | 
| +    }
 | 
| +  }
 | 
| +}
 | 
| +</script>
 | 
| +</head>
 | 
| +<body>
 | 
| +
 | 
| +<script type="application/dart">
 | 
| +import 'dart:async';
 | 
| +import 'package:unittest/unittest.dart';
 | 
| +import 'Multiscript.dart';
 | 
| +
 | 
| +main() {
 | 
| +  State.registerCallback(0, () {
 | 
| +    // FIXME: Rewrite this test to use html-imports.
 | 
| +    print("Running script 0");
 | 
| +    State.update();
 | 
| +    expect(State.sJs, equals(1));
 | 
| +    expect(State.sDart, equals(1));
 | 
| +  });
 | 
| +}
 | 
| +</script>
 | 
| +
 | 
| +<script type="application/dart">
 | 
| +import 'dart:js' as js;
 | 
| +import 'dart:math';
 | 
| +import 'package:unittest/unittest.dart';
 | 
| +import 'Multiscript.dart';
 | 
| +
 | 
| +main() {
 | 
| +  State.registerCallback(1, () {
 | 
| +    print("Running script 1");
 | 
| +    State.update();
 | 
| +    expect(State.sJs, equals(2));
 | 
| +    expect(State.sDart, equals(1));
 | 
| +    js.context['doubleValue'] = (x) => x*2;
 | 
| +    expect(js.context.callMethod('doubleValue', [21]), equals(42));
 | 
| +    expect(js.context.callMethod('doubleValue', ["Foo"]), equals("FooFoo"));
 | 
| +    // Point is not a primitive type so passing it to a different isolate is
 | 
| +    // not allowed.
 | 
| +    expect(js.context.callMethod('doubleValue', [new Point(2, 4)]),
 | 
| +        equals(new Point(4, 8)));
 | 
| +  });
 | 
| +}
 | 
| +</script>
 | 
| +
 | 
| +<script type="application/dart">
 | 
| +import 'package:unittest/unittest.dart';
 | 
| +import 'Multiscript.dart';
 | 
| +
 | 
| +main() {
 | 
| +  State.registerCallback(2, () {
 | 
| +    print("Running script 2");
 | 
| +    State.update();
 | 
| +    expect(State.sJs, equals(3));
 | 
| +    expect(State.sDart, equals(1));
 | 
| +  });
 | 
| +}
 | 
| +</script>
 | 
| +
 | 
| +<script type="application/dart">
 | 
| +import 'dart:js' as js;
 | 
| +import 'dart:math';
 | 
| +import 'package:unittest/unittest.dart';
 | 
| +import 'package:unittest/html_config.dart';
 | 
| +import 'Multiscript.dart';
 | 
| +
 | 
| +main() {
 | 
| +  State.registerCallback(3, () {
 | 
| +    print("Running script 3");
 | 
| +    useHtmlConfiguration(true);
 | 
| +    test('Multiple script tags', () {
 | 
| +      State.update();
 | 
| +      expect(State.sJs, equals(4));
 | 
| +      expect(State.sDart, equals(1));
 | 
| +
 | 
| +      // doubleValue is from a different Dart isolate but arguments are primitive
 | 
| +      // types so it is safe to call.
 | 
| +      expect(js.context.callMethod('doubleValue', [21]), equals(42));
 | 
| +      expect(js.context.callMethod('doubleValue', ["Foo"]), equals("FooFoo"));
 | 
| +      // Point is not a primitive type so passing it to a different isolate
 | 
| +      // using js interop results in a JsObject rather than a Point. A
 | 
| +      // NoSuchMethodError is thrown in the other Dart isolate but once the
 | 
| +      // error gets to this isolate it shows up as just an Unhandled Exception.
 | 
| +      expect(() {
 | 
| +            try {
 | 
| +              js.context.callMethod('doubleValue', [new Point(2, 4)]);
 | 
| +            } catch (e) {
 | 
| +              throw new Exception(e.toString());
 | 
| +            }
 | 
| +          },
 | 
| +          throwsException);
 | 
| +    });
 | 
| +  });
 | 
| +}
 | 
| +</script>
 | 
| +</body>
 | 
| +</html>
 | 
| 
 |