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

Side by Side Diff: utils/tests/pub/test_pub.dart

Issue 10917053: Show nicer errors on some server failures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unnecessary check. Created 8 years, 3 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 | « utils/tests/pub/pub_update_hosted_test.dart ('k') | no next file » | 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) 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 /** 5 /**
6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub
7 * tests are integration tests that stage some stuff on the file system, run 7 * tests are integration tests that stage some stuff on the file system, run
8 * pub, and then validate the results. This library provides an API to build 8 * pub, and then validate the results. This library provides an API to build
9 * tests like that. 9 * tests like that.
10 */ 10 */
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 } 542 }
543 543
544 Future<Directory> _setUpSandbox() { 544 Future<Directory> _setUpSandbox() {
545 return createTempDir(); 545 return createTempDir();
546 } 546 }
547 547
548 Future _runScheduled(Directory parentDir, List<_ScheduledEvent> scheduled) { 548 Future _runScheduled(Directory parentDir, List<_ScheduledEvent> scheduled) {
549 if (scheduled == null) return new Future.immediate(null); 549 if (scheduled == null) return new Future.immediate(null);
550 var iterator = scheduled.iterator(); 550 var iterator = scheduled.iterator();
551 551
552 Future runNextEvent([_]) { 552 Future runNextEvent(_) {
553 if (_abortScheduled || !iterator.hasNext()) { 553 if (_abortScheduled || !iterator.hasNext()) {
554 _abortScheduled = false; 554 _abortScheduled = false;
555 scheduled.clear(); 555 scheduled.clear();
556 return new Future.immediate(null); 556 return new Future.immediate(null);
557 } 557 }
558 558
559 var future = iterator.next()(parentDir); 559 var future = iterator.next()(parentDir);
560 if (future != null) { 560 if (future != null) {
561 return future.chain(runNextEvent); 561 return future.chain(runNextEvent);
562 } else { 562 } else {
563 return runNextEvent(); 563 return runNextEvent(null);
564 } 564 }
565 } 565 }
566 566
567 return runNextEvent(); 567 return runNextEvent(null);
568 } 568 }
569 569
570 /** 570 /**
571 * Compares the [actual] output from running pub with [expected]. For [String] 571 * Compares the [actual] output from running pub with [expected]. For [String]
572 * patterns, ignores leading and trailing whitespace differences and tries to 572 * patterns, ignores leading and trailing whitespace differences and tries to
573 * report the offending difference in a nice way. For other [Pattern]s, just 573 * report the offending difference in a nice way. For other [Pattern]s, just
574 * reports whether the output contained the pattern. 574 * reports whether the output contained the pattern.
575 */ 575 */
576 void _validateOutput(Pattern expected, List<String> actual) { 576 void _validateOutput(Pattern expected, List<String> actual) {
577 if (expected == null) return; 577 if (expected == null) return;
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 } 1091 }
1092 1092
1093 /** 1093 /**
1094 * Schedules a callback to be called after Pub is run with [runPub], even if it 1094 * Schedules a callback to be called after Pub is run with [runPub], even if it
1095 * fails. 1095 * fails.
1096 */ 1096 */
1097 void _scheduleCleanup(_ScheduledEvent event) { 1097 void _scheduleCleanup(_ScheduledEvent event) {
1098 if (_scheduledCleanup == null) _scheduledCleanup = []; 1098 if (_scheduledCleanup == null) _scheduledCleanup = [];
1099 _scheduledCleanup.add(event); 1099 _scheduledCleanup.add(event);
1100 } 1100 }
OLDNEW
« no previous file with comments | « utils/tests/pub/pub_update_hosted_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698