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

Side by Side Diff: test/observe_test.dart

Issue 55143003: webui fixes for 0.8.9 (Closed) Base URL: git@github.com:dart-lang/web-ui.git@master
Patch Set: Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** Tests for some of the utility helper functions used by the compiler. */ 5 /** Tests for some of the utility helper functions used by the compiler. */
6 library observe_test; 6 library observe_test;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:collection' show LinkedHashMap; 9 import 'dart:collection' show LinkedHashMap;
10 import 'package:unittest/compact_vm_config.dart'; 10 import 'package:unittest/compact_vm_config.dart';
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 test('unobserve one of two observers', () { 126 test('unobserve one of two observers', () {
127 var t = new ObservableReference<int>(123); 127 var t = new ObservableReference<int>(123);
128 ChangeUnobserver unobserve; 128 ChangeUnobserver unobserve;
129 unobserve = observe(() => t.value, expectAsync1((n) { 129 unobserve = observe(() => t.value, expectAsync1((n) {
130 expect(n.oldValue, 123); 130 expect(n.oldValue, 123);
131 expect(n.newValue, 42); 131 expect(n.newValue, 42);
132 132
133 // This will not affect the other observer, so it still gets the event. 133 // This will not affect the other observer, so it still gets the event.
134 unobserve(); 134 unobserve();
135 runAsync(() => t.value = 777); 135 scheduleMicrotask(() => t.value = 777);
136 })); 136 }));
137 int count = 0; 137 int count = 0;
138 observe(() => t.value + 1000, expectAsync1((n) { 138 observe(() => t.value + 1000, expectAsync1((n) {
139 if (++count == 1) { 139 if (++count == 1) {
140 expect(n.oldValue, 1123); 140 expect(n.oldValue, 1123);
141 expect(n.newValue, 1042); 141 expect(n.newValue, 1042);
142 } else { 142 } else {
143 expect(n.oldValue, 1042); 143 expect(n.oldValue, 1042);
144 expect(n.newValue, 1777); 144 expect(n.newValue, 1777);
145 } 145 }
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 var c = _change(123, 43); 870 var c = _change(123, 43);
871 expect(a.hashCode, b.hashCode, reason: 'a == b'); 871 expect(a.hashCode, b.hashCode, reason: 'a == b');
872 expect(b.hashCode, isNot(equals(c.hashCode)), reason: 'b != c'); 872 expect(b.hashCode, isNot(equals(c.hashCode)), reason: 'b != c');
873 }); 873 });
874 } 874 }
875 875
876 _change(oldValue, newValue) => new ChangeNotification(oldValue, newValue); 876 _change(oldValue, newValue) => new ChangeNotification(oldValue, newValue);
877 877
878 _record(type, key, oldValue, newValue) => 878 _record(type, key, oldValue, newValue) =>
879 new ChangeRecord(type, key, oldValue, newValue); 879 new ChangeRecord(type, key, oldValue, newValue);
OLDNEW
« pubspec.yaml ('K') | « test/html5_utils_test.dart ('k') | test/paths_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698