| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 /// Whitebox integration/end-to-end test of Try Dart! site. |
| 6 /// |
| 7 /// This test opens Try Dart! in an iframe. When opened the first time, Try |
| 8 /// Dart! will display a simple hello-world example, color tokens, compile the |
| 9 /// example, and run the result. We've instrumented Try Dart! to use |
| 10 /// window.parent.postMessage when the running program prints anything. So this |
| 11 /// test just waits for a "Hello, World!" message. |
| 12 library trydart.end_to_end_test; |
| 13 |
| 14 import 'dart:html'; |
| 15 import 'dart:async'; |
| 16 |
| 17 import 'package:async_helper/async_helper.dart'; |
| 18 |
| 19 void main() { |
| 20 asyncStart(); |
| 21 window.onMessage.listen((MessageEvent e) { |
| 22 if (e.data == 'Hello, World!\n') { |
| 23 // Clear the DOM to work around a bug in test.dart. |
| 24 document.body.nodes.clear(); |
| 25 |
| 26 // Clean up after ourselves. |
| 27 window.localStorage.clear(); |
| 28 |
| 29 asyncSuccess(null); |
| 30 } else { |
| 31 window.console.dir(e.data); |
| 32 } |
| 33 }); |
| 34 |
| 35 // Clearing localStorage makes Try Dart! think it is opening for the first |
| 36 // time. |
| 37 window.localStorage.clear(); |
| 38 |
| 39 document.body.append(new IFrameElement() |
| 40 ..src = '/root_build/try_dartlang_org/index.html' |
| 41 ..style.width = '90vw' |
| 42 ..style.height = '90vh'); |
| 43 } |
| OLD | NEW |