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

Unified Diff: pkg/mdv_observe/test/observe_test.dart

Issue 17552019: Reorganize mdv and observe packages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/mdv_observe/test/observable_map_test.dart ('k') | pkg/mdv_observe/test/path_observer_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/mdv_observe/test/observe_test.dart
diff --git a/pkg/mdv_observe/test/observe_test.dart b/pkg/mdv_observe/test/observe_test.dart
deleted file mode 100644
index 8d6e6d3b2d1de66538b66ad7aa4a6bbb7e6db37c..0000000000000000000000000000000000000000
--- a/pkg/mdv_observe/test/observe_test.dart
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-import 'package:mdv_observe/mdv_observe.dart';
-import 'package:unittest/unittest.dart';
-import 'utils.dart';
-
-main() {
- // Note: to test the basic Observable system, we use ObservableBox due to its
- // simplicity.
-
- const _VALUE = const Symbol('value');
-
- group('ObservableBox', () {
- test('no observers', () {
- var t = new ObservableBox<int>(123);
- expect(t.value, 123);
- t.value = 42;
- expect(t.value, 42);
- expect(t.hasObservers, false);
- });
-
- test('listen adds an observer', () {
- var t = new ObservableBox<int>(123);
- expect(t.hasObservers, false);
-
- t.changes.listen((n) {});
- expect(t.hasObservers, true);
- });
-
- test('changes delived async', () {
- var t = new ObservableBox<int>(123);
- int called = 0;
-
- t.changes.listen(expectAsync1((records) {
- called++;
- expectChanges(records, [_record(_VALUE), _record(_VALUE)]);
- }));
- t.value = 41;
- t.value = 42;
- expect(called, 0);
- });
-
- test('cause changes in handler', () {
- var t = new ObservableBox<int>(123);
- int called = 0;
-
- t.changes.listen(expectAsync1((records) {
- called++;
- expectChanges(records, [_record(_VALUE)]);
- if (called == 1) {
- // Cause another change
- t.value = 777;
- }
- }, count: 2));
-
- t.value = 42;
- });
-
- test('multiple observers', () {
- var t = new ObservableBox<int>(123);
-
- verifyRecords(records) {
- expectChanges(records, [_record(_VALUE), _record(_VALUE)]);
- };
-
- t.changes.listen(expectAsync1(verifyRecords));
- t.changes.listen(expectAsync1(verifyRecords));
-
- t.value = 41;
- t.value = 42;
- });
-
- test('deliverChangeRecords', () {
- var t = new ObservableBox<int>(123);
- var records = [];
- t.changes.listen((r) { records.addAll(r); });
- t.value = 41;
- t.value = 42;
- expectChanges(records, [], reason: 'changes delived async');
-
- deliverChangeRecords();
- expectChanges(records,
- [_record(_VALUE), _record(_VALUE)]);
- records.clear();
-
- t.value = 777;
- expectChanges(records, [], reason: 'changes delived async');
-
- deliverChangeRecords();
- expectChanges(records, [_record(_VALUE)]);
-
- // Has no effect if there are no changes
- deliverChangeRecords();
- expectChanges(records, [_record(_VALUE)]);
- });
-
- test('cancel listening', () {
- var t = new ObservableBox<int>(123);
- var sub;
- sub = t.changes.listen(expectAsync1((records) {
- expectChanges(records, [_record(_VALUE)]);
- sub.cancel();
- t.value = 777;
- }));
- t.value = 42;
- });
-
- test('cancel and reobserve', () {
- var t = new ObservableBox<int>(123);
- var sub;
- sub = t.changes.listen(expectAsync1((records) {
- expectChanges(records, [_record(_VALUE)]);
- sub.cancel();
-
- runAsync(expectAsync0(() {
- sub = t.changes.listen(expectAsync1((records) {
- expectChanges(records, [_record(_VALUE)]);
- }));
- t.value = 777;
- }));
- }));
- t.value = 42;
- });
- });
-}
-
-_record(key) => new PropertyChangeRecord(key);
« no previous file with comments | « pkg/mdv_observe/test/observable_map_test.dart ('k') | pkg/mdv_observe/test/path_observer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698