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

Unified Diff: tools/dom/docs/lib/docs.dart

Issue 13000005: Added tests for docs.dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
Index: tools/dom/docs/lib/docs.dart
diff --git a/tools/dom/docs/lib/docs.dart b/tools/dom/docs/lib/docs.dart
index e4606ff259e787af36fb5302b6fb2fc9042cf990..7495fcdfb5a89596e701fea66c6bf5331404fc8f 100644
--- a/tools/dom/docs/lib/docs.dart
+++ b/tools/dom/docs/lib/docs.dart
@@ -1,3 +1,7 @@
+// 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.
+
/**
* A library for extracting the documentation from the various HTML libraries
* ([dart:html], [dart:svg], [dart:web_audio], [dart:indexed_db]) and saving
@@ -55,18 +59,18 @@ Future<bool> convert(Path libPath, Path jsonPath) {
return analyze(paths, libPath, options: ['--preserve-comments'])
.then((MirrorSystem mirrors) {
var convertedJson = _generateJsonFromLibraries(mirrors);
- return new Future.immediate(_exportJsonToFile(convertedJson, jsonPath));
+ return _exportJsonToFile(convertedJson, jsonPath);
});
}
-bool _exportJsonToFile(Map convertedJson, Path jsonPath) {
+Future<bool> _exportJsonToFile(Map convertedJson, Path jsonPath) {
Bob Nystrom 2013/03/28 14:18:40 This method does both sync and async IO, which mea
Andrei Mouravski 2013/03/28 17:01:14 Done.
final jsonFile = new File.fromPath(jsonPath);
var writeJson = prettySerialize(convertedJson);
var outputStream = jsonFile.openWrite();
outputStream.writeln(writeJson);
-
- return false;
+ outputStream.close();
+ return outputStream.done.then((_) => false);
}
Map _generateJsonFromLibraries(MirrorSystem mirrors) {

Powered by Google App Engine
This is Rietveld 408576698