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

Side by Side Diff: pkg/analysis_server/test/integration/integration_tests.dart

Issue 437383003: Simplify handling of pathnames in integration tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 test.integration.analysis; 5 library test.integration.analysis;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 */ 48 */
49 bool skipShutdown = false; 49 bool skipShutdown = false;
50 50
51 /** 51 /**
52 * Data associated with the "server.connected" notification that was received 52 * Data associated with the "server.connected" notification that was received
53 * when the server started up. 53 * when the server started up.
54 */ 54 */
55 var serverConnectedParams; 55 var serverConnectedParams;
56 56
57 /** 57 /**
58 * Write a source file with the given contents. [relativePath] 58 * Write a source file with the given absolute [pathname] and [contents].
59 * is relative to [sourceDirectory]; on Windows any forward slashes it
60 * contains are converted to backslashes.
61 * 59 *
62 * If the file didn't previously exist, it is created. If it did, it is 60 * If the file didn't previously exist, it is created. If it did, it is
63 * overwritten. 61 * overwritten.
62 *
63 * Parent directories are created as necessary.
64 */ 64 */
65 void writeFile(String relativePath, String contents) { 65 void writeFile(String pathname, String contents) {
66 String absolutePath = normalizePath(relativePath); 66 new Directory(dirname(pathname)).createSync(recursive: true);
67 new Directory(dirname(absolutePath)).createSync(recursive: true); 67 new File(pathname).writeAsStringSync(contents);
68 new File(absolutePath).writeAsStringSync(contents);
69 } 68 }
70 69
71 /** 70 /**
72 * Convert the given [relativePath] to an absolute path, by interpreting it 71 * Convert the given [relativePath] to an absolute path, by interpreting it
73 * relative to [sourceDirectory]. On Windows any forward slashes in 72 * relative to [sourceDirectory]. On Windows any forward slashes in
74 * [relativePath] are converted to backslashes. 73 * [relativePath] are converted to backslashes.
75 */ 74 */
76 String normalizePath(String relativePath) { 75 String sourcePath(String relativePath) {
77 return join(sourceDirectory.path, relativePath.replaceAll('/', separator)); 76 return join(sourceDirectory.path, relativePath.replaceAll('/', separator));
78 } 77 }
79 78
80 /** 79 /**
81 * Send the server an 'analysis.setAnalysisRoots' command. 80 * Send the server an 'analysis.setAnalysisRoots' command directing it to
81 * analyze [sourceDirectory].
82 */ 82 */
83 Future setAnalysisRoots(List<String> relativeRoots) { 83 Future standardAnalysisRoot() {
84 return server.send(ANALYSIS_SET_ANALYSIS_ROOTS, { 84 return server.send(ANALYSIS_SET_ANALYSIS_ROOTS, {
85 'included': relativeRoots.map(normalizePath).toList(), 85 'included': [sourceDirectory.path],
86 'excluded': [] 86 'excluded': []
87 }); 87 });
88 } 88 }
89 89
90 /** 90 /**
91 * Send the server a 'server.setSubscriptions' command. 91 * Send the server a 'server.setSubscriptions' command.
92 */ 92 */
93 Future server_setSubscriptions(List<String> subscriptions) { 93 Future server_setSubscriptions(List<String> subscriptions) {
94 return server.send(SERVER_SET_SUBSCRIPTIONS, { 94 return server.send(SERVER_SET_SUBSCRIPTIONS, {
95 'subscriptions': subscriptions 95 'subscriptions': subscriptions
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 */ 700 */
701 void _recordStdio(String line) { 701 void _recordStdio(String line) {
702 double elapsedTime = _time.elapsedTicks / _time.frequency; 702 double elapsedTime = _time.elapsedTicks / _time.frequency;
703 line = "$elapsedTime: $line"; 703 line = "$elapsedTime: $line";
704 if (_debuggingStdio) { 704 if (_debuggingStdio) {
705 print(line); 705 print(line);
706 } 706 }
707 _recordedStdio.add(line); 707 _recordedStdio.add(line);
708 } 708 }
709 } 709 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698