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

Side by Side Diff: tests/html/events_test.dart

Issue 133313004: pkg/unittest: Run tests in zones (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nit Created 6 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
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/lib/async/future_timeout_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 tests.html.events_test; 5 library tests.html.events_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'package:unittest/html_config.dart'; 10 import 'package:unittest/html_config.dart';
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 expect(invocationCounter, isZero); 64 expect(invocationCounter, isZero);
65 65
66 provider.forTarget(element).listen(handler); 66 provider.forTarget(element).listen(handler);
67 invocationCounter = 0; 67 invocationCounter = 0;
68 element.dispatchEvent(event); 68 element.dispatchEvent(event);
69 expect(invocationCounter, 1); 69 expect(invocationCounter, 1);
70 70
71 provider.forTarget(element).listen(handler); 71 provider.forTarget(element).listen(handler);
72 invocationCounter = 0; 72 invocationCounter = 0;
73 element.dispatchEvent(event); 73 element.dispatchEvent(event);
74 expect(invocationCounter, 1); 74
75 // NOTE: when run in a custom zone, the handler is wrapped
76 // The logic for html events which ensures identical handlers are added only
77 // once is therefor muted by the wrapped handlers.
78 // Hence, we get different behavior depending on the current zone.
79 if(Zone.current == Zone.ROOT) {
80 expect(invocationCounter, 1);
81 } else {
82 expect(invocationCounter, 2);
83 }
75 }); 84 });
76 85
77 test('InitMouseEvent', () { 86 test('InitMouseEvent', () {
78 DivElement div = new Element.tag('div'); 87 DivElement div = new Element.tag('div');
79 MouseEvent event = new MouseEvent('zebra', relatedTarget: div); 88 MouseEvent event = new MouseEvent('zebra', relatedTarget: div);
80 }); 89 });
81 90
82 test('DOM event callbacks are associated with the correct zone', () { 91 test('DOM event callbacks are associated with the correct zone', () {
83 var callbacks = []; 92 var callbacks = [];
84 93
(...skipping 16 matching lines...) Expand all
101 expect(Zone.current, equals(zone)); 110 expect(Zone.current, equals(zone));
102 sub.cancel(); 111 sub.cancel();
103 })); 112 }));
104 } 113 }
105 114
106 sub = element.on['test'].listen(expectAsync1(handler)); 115 sub = element.on['test'].listen(expectAsync1(handler));
107 })); 116 }));
108 element.dispatchEvent(new Event('test')); 117 element.dispatchEvent(new Event('test'));
109 }); 118 });
110 } 119 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/lib/async/future_timeout_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698