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

Side by Side Diff: samples/tests/samples/src/swarm/SwarmTest.dart

Issue 10031022: step 1 in making unittest platform independent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library('swarm_tests'); 5 #library('swarm_tests');
6 6
7 #import('dart:html'); 7 #import('dart:html');
8 #import('../../../../swarm/swarmlib.dart'); 8 #import('../../../../swarm/swarmlib.dart');
9 #import('../../../../ui_lib/base/base.dart'); 9 #import('../../../../ui_lib/base/base.dart');
10 #import('../../../../ui_lib/view/view.dart'); 10 #import('../../../../ui_lib/view/view.dart');
(...skipping 27 matching lines...) Expand all
38 final feed = article.dataSource; 38 final feed = article.dataSource;
39 return { 39 return {
40 'section': CollectionUtils.find(swarm.sections, 40 'section': CollectionUtils.find(swarm.sections,
41 (s) => s.feeds.indexOf(feed, 0) >= 0).id, 41 (s) => s.feeds.indexOf(feed, 0) >= 0).id,
42 'feed': feed.id, 42 'feed': feed.id,
43 'article': article.id 43 'article': article.id
44 }; 44 };
45 } 45 }
46 46
47 asyncTest('BackButton', 1, () { 47 asyncTest('BackButton', 1, () {
48 serialInvokeAsync([() { 48 _serialInvokeAsync([() {
49 Expect.equals(null, swarm.frontView.storyView); // verify initial state 49 Expect.equals(null, swarm.frontView.storyView); // verify initial state
50 50
51 // Make sure we've transitioned to the section 51 // Make sure we've transitioned to the section
52 // In the real app, this isn't needed because ConveyorView fires the 52 // In the real app, this isn't needed because ConveyorView fires the
53 // transition end event before we can click a story. 53 // transition end event before we can click a story.
54 SectionView section = getView(swarm.sections[0]); 54 SectionView section = getView(swarm.sections[0]);
55 section.showSources(); 55 section.showSources();
56 }, 56 },
57 () { 57 () {
58 final item = swarm.sections[0].feeds[2].articles[1]; 58 final item = swarm.sections[0].feeds[2].articles[1];
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void expectHistory(List<Map<String, String>> entries) { 130 void expectHistory(List<Map<String, String>> entries) {
131 Expect.equals(entries.length, history.length); 131 Expect.equals(entries.length, history.length);
132 for (int i = 0; i < entries.length; i++) { 132 for (int i = 0; i < entries.length; i++) {
133 Map e = entries[i]; 133 Map e = entries[i];
134 Map h = history[i]; 134 Map h = history[i];
135 Expect.equals(e['article'], h['article']); 135 Expect.equals(e['article'], h['article']);
136 } 136 }
137 clearHistory(); 137 clearHistory();
138 } 138 }
139 } 139 }
140
141 void _serialInvokeAsync(List closures) {
142 final length = closures.length;
143 if (length > 0) {
144 int i = 0;
145 void invokeNext() {
146 closures[i]();
147 i++;
148 if (i < length) {
149 window.setTimeout(invokeNext, 0);
150 }
151 }
152 window.setTimeout(invokeNext, 0);
153 }
154 }
OLDNEW
« lib/unittest/unittest_html.dart ('K') | « samples/tests/samples/src/dartcombat/DartCombatTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698