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

Side by Side Diff: samples/third_party/dromaeo/Dromaeo.dart

Issue 12086028: Fix up dromaeo after lib v2 merge and add Dromaeo smoketest to prevent future (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library dromaeo_test;
2
1 import 'dart:html'; 3 import 'dart:html';
2 import 'dart:json' as json; 4 import 'dart:json' as json;
3 import 'dart:math' as Math; 5 import 'dart:math' as Math;
4 import 'Suites.dart'; 6 import 'Suites.dart';
5 7
6 main() { 8 main() {
7 new Dromaeo().run(); 9 new Dromaeo().run();
8 } 10 }
9 11
10 class SuiteController { 12 class SuiteController {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 Dromaeo() 93 Dromaeo()
92 : _suiteControllers = new List<SuiteController>() 94 : _suiteControllers = new List<SuiteController>()
93 { 95 {
94 _handler = _createHandler(); 96 _handler = _createHandler();
95 window.on.message.add( 97 window.on.message.add(
96 (MessageEvent event) { 98 (MessageEvent event) {
97 try { 99 try {
98 final response = json.parse(event.data); 100 final response = json.parse(event.data);
99 _handler = _handler(response['command'], response['data']); 101 _handler = _handler(response['command'], response['data']);
100 } catch (e, stacktrace) { 102 } catch (e, stacktrace) {
101 window.alert('Exception: ${e}: ${stacktrace}'); 103 if (!(e is FormatException &&
Emily Fortuna 2013/01/30 01:15:56 The fact that this was an alert window causes issu
104 (event.data.toString().startsWith('unittest') ||
105 event.data.toString().startsWith('dart')))) {
106 // Hack because unittest also uses post messages to communicate.
107 // So the fact that the event.data is not proper json is not
108 // always an error.
109 print('Exception: ${e}: ${stacktrace}');
110 print(event.data);
111 }
102 } 112 }
103 }, 113 },
104 false 114 false
105 ); 115 );
106 } 116 }
107 117
108 run() { 118 run() {
109 // TODO(vsm): Initial page should not run. For now, run all 119 // TODO(vsm): Initial page should not run. For now, run all
110 // tests by default. 120 // tests by default.
111 final splitUrl = window.location.href.split('?'); 121 var tags = window.location.search;
112 var tags; 122 if (tags.length > 1) {
113 if (splitUrl.length > 1) { 123 tags = tags.substring(1);
114 tags = splitUrl[1];
115 } else if (window.navigator.userAgent.contains('(Dart)')) { 124 } else if (window.navigator.userAgent.contains('(Dart)')) {
116 // TODO(vsm): Update when we change Dart VM detection. 125 // TODO(vsm): Update when we change Dart VM detection.
117 tags = 'js|dart&html'; 126 tags = 'js|dart&html';
118 } else { 127 } else {
119 tags = 'js|dart2js&html'; 128 tags = 'js|dart2js&html';
120 } 129 }
121 130
122 // TODO(antonm): create Re-run tests href. 131 // TODO(antonm): create Re-run tests href.
123 final Element suiteNameElement = _byId('overview').nodes[0]; 132 final Element suiteNameElement = _byId('overview').nodes[0];
124 final category = Suites.getCategory(tags); 133 final category = Suites.getCategory(tags);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 222 }
214 223
215 Element _byId(String id) { 224 Element _byId(String id) {
216 return document.query('#$id'); 225 return document.query('#$id');
217 } 226 }
218 227
219 int get _suitesTotal { 228 int get _suitesTotal {
220 return _suiteControllers.length; 229 return _suiteControllers.length;
221 } 230 }
222 } 231 }
OLDNEW
« no previous file with comments | « no previous file | samples/third_party/dromaeo/Suites.dart » ('j') | tests/html/dromaeo_noop/dromaeo_smoke.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698