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

Side by Side Diff: samples/tests/samples/swarm/swarm_test.dart

Issue 11810004: Make browser tests all run from a server instead of the local filesystem. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 '../../../swarm/swarm_ui_lib/base/base.dart'; 9 import '../../../swarm/swarm_ui_lib/base/base.dart';
10 import '../../../swarm/swarm_ui_lib/view/view.dart'; 10 import '../../../swarm/swarm_ui_lib/view/view.dart';
11 import '../../../swarm/swarm_ui_lib/util/utilslib.dart'; 11 import '../../../swarm/swarm_ui_lib/util/utilslib.dart';
12 import '../../../../pkg/unittest/lib/unittest.dart'; 12 import '../../../../pkg/unittest/lib/unittest.dart';
13 import '../../../../pkg/unittest/lib/html_config.dart'; 13 import '../../../../pkg/unittest/lib/html_config.dart';
14 14
15 // TODO(jmesserly): these would probably be easier to debug if they were written 15 // TODO(jmesserly): these would probably be easier to debug if they were written
16 // in the WebKit layout test style, so we could easy compare that the DOM is 16 // in the WebKit layout test style, so we could easy compare that the DOM is
17 // what we expect it to be after performing some simulated user actions. 17 // what we expect it to be after performing some simulated user actions.
18 18
19 void main() { 19 void main() {
20 useHtmlConfiguration(); 20 useHtmlConfiguration();
21 Swarm swarm = new Swarm(); 21 Swarm swarm = new Swarm(useCannedData: true);
22 UIStateProxy state = new UIStateProxy(swarm.sections); 22 UIStateProxy state = new UIStateProxy(swarm.sections);
23 swarm.state = state; 23 swarm.state = state;
24 swarm.run(); 24 swarm.run();
25 // TODO(jmesserly): should be adding the full stylesheet here 25 // TODO(jmesserly): should be adding the full stylesheet here
26 Dom.addStyle(''' 26 Dom.addStyle('''
27 .story-content { 27 .story-content {
28 -webkit-column-width: 300px; 28 -webkit-column-width: 300px;
29 -webkit-column-gap: 26px; /* 2em */ 29 -webkit-column-gap: 26px; /* 2em */
30 }'''); 30 }''');
31 31
(...skipping 17 matching lines...) Expand all
49 test('BackButton', () { 49 test('BackButton', () {
50 _serialInvokeAsync([ 50 _serialInvokeAsync([
51 () { 51 () {
52 Expect.equals(null, swarm.frontView.storyView); // verify initial state 52 Expect.equals(null, swarm.frontView.storyView); // verify initial state
53 53
54 // Make sure we've transitioned to the section 54 // Make sure we've transitioned to the section
55 // In the real app, this isn't needed because ConveyorView fires the 55 // In the real app, this isn't needed because ConveyorView fires the
56 // transition end event before we can click a story. 56 // transition end event before we can click a story.
57 SectionView section = getView(swarm.sections[0]); 57 SectionView section = getView(swarm.sections[0]);
58 section.showSources(); 58 section.showSources();
59 }, 59 },
60 () { 60 () {
61 final item = swarm.sections[0].feeds[2].articles[1]; 61 final item = swarm.sections[0].feeds[2].articles[1];
62 state.loadFromHistory(getHistory(item)); 62 state.loadFromHistory(getHistory(item));
63 63
64 Expect.equals(item, state.currentArticle.value); 64 Expect.equals(item, state.currentArticle.value);
65 65
66 Expect.isFalse(getStoryNode().classes.contains(CSS.HIDDEN_STORY)); 66 Expect.isFalse(getStoryNode().classes.contains(CSS.HIDDEN_STORY));
67 67
68 state.loadFromHistory({}); 68 state.loadFromHistory({});
69 69
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 void invokeNext() { 148 void invokeNext() {
149 closures[i](); 149 closures[i]();
150 i++; 150 i++;
151 if (i < length) { 151 if (i < length) {
152 window.setTimeout(expectAsync0(invokeNext), 0); 152 window.setTimeout(expectAsync0(invokeNext), 0);
153 } 153 }
154 } 154 }
155 window.setTimeout(expectAsync0(invokeNext), 0); 155 window.setTimeout(expectAsync0(invokeNext), 0);
156 } 156 }
157 } 157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698