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

Unified Diff: editor/tools/plugins/com.google.dart.server_test/src/com/google/dart/server/internal/remote/RemoteAnalysisServerImplTest.java

Issue 874373003: Library dependencies server API updates (to pass package maps). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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: editor/tools/plugins/com.google.dart.server_test/src/com/google/dart/server/internal/remote/RemoteAnalysisServerImplTest.java
===================================================================
--- editor/tools/plugins/com.google.dart.server_test/src/com/google/dart/server/internal/remote/RemoteAnalysisServerImplTest.java (revision 43154)
+++ editor/tools/plugins/com.google.dart.server_test/src/com/google/dart/server/internal/remote/RemoteAnalysisServerImplTest.java (working copy)
@@ -91,8 +91,10 @@
import com.google.gson.JsonParser;
import static org.fest.assertions.Assertions.assertThat;
+import static org.fest.assertions.MapAssert.entry;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -413,11 +415,14 @@
public void test_analysis_getLibraryDependencies() throws Exception {
final String[][] libraries = {{null}};
+ final List<Map<String, Map<String, List<String>>>> packageMap = Lists.newArrayList();
final RequestError[] requestErrorArray = {null};
server.analysis_getLibraryDependencies(new GetLibraryDependenciesConsumer() {
@Override
- public void computedDependencies(String[] libs) {
+ public void computedDependencies(String[] libs,
+ Map<String, Map<String, List<String>>> packages) {
libraries[0] = libs;
+ packageMap.add(packages);
}
@Override
@@ -438,27 +443,43 @@
"{",
" 'id': '0',",
" 'result': {",
+ " 'packageMap': {",
+ " '/context1/' : {",
+ " 'a' : ['/a/', '/a1/'],",
+ " 'b' : ['/b/', '/b1/']",
+ " },",
+ " '/context2/' : {",
+ " 'c' : ['/c/', '/c1/']",
+ " }",
+ " },",
" 'libraries': [",
" '/a/b/c.dart',",
" '/d/e/f.dart',",
" '/g/h/i.dart'",
- " ]",
- " }",
+ " ]",
+ " }",
"}");
responseStream.waitForEmpty();
server.test_waitForWorkerComplete();
assertNull(requestErrorArray[0]);
assertThat(libraries[0]).hasSize(3);
+ assertThat(packageMap).hasSize(1);
+ assertThat(packageMap.get(0).get("/context1/")).includes(
+ entry("a", Arrays.asList("/a/", "/a1/")));
+
}
public void test_analysis_getLibraryDependenciess_error() throws Exception {
- final String[][] directories = {null};
+ final String[][] libraries = {null};
+ final List<Map<String, Map<String, List<String>>>> packageMap = Lists.newArrayList();
final RequestError[] requestErrorArray = {null};
server.analysis_getLibraryDependencies(new GetLibraryDependenciesConsumer() {
@Override
- public void computedDependencies(String[] dirs) {
- directories[0] = dirs;
+ public void computedDependencies(String[] libs,
+ Map<String, Map<String, List<String>>> packages) {
+ libraries[0] = libs;
+ packageMap.add(packages);
}
@Override
@@ -488,7 +509,8 @@
responseStream.waitForEmpty();
server.test_waitForWorkerComplete();
- assertNull(directories[0]);
+ assertNull(libraries[0]);
+ assertThat(packageMap).isEmpty();
assertNotNull(requestErrorArray[0]);
RequestError requestError = requestErrorArray[0];
assertEquals("CONTENT_MODIFIED", requestError.getCode());

Powered by Google App Engine
This is Rietveld 408576698