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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.tools.debug.core_test/src/com/google/dart/tools/debug/core/dartium/BreakpointManagerTest.java

Issue 126303002: Version 1.1.0-dev.5.3 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, the Dart project authors. 2 * Copyright (c) 2013, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
11 * or implied. See the License for the specific language governing permissions a nd limitations under 11 * or implied. See the License for the specific language governing permissions a nd limitations under
12 * the License. 12 * the License.
13 */ 13 */
14 14
15 package com.google.dart.tools.debug.core.dartium; 15 package com.google.dart.tools.debug.core.dartium;
16 16
17 import com.google.dart.engine.source.ExplicitPackageUriResolver; 17 import com.google.dart.engine.source.ExplicitPackageUriResolver;
18 import com.google.dart.engine.source.ExplicitPackageUriResolverTest; 18 import com.google.dart.engine.source.ExplicitPackageUriResolverTest;
19 import com.google.dart.tools.core.DartCore;
19 20
20 import junit.framework.TestCase; 21 import junit.framework.TestCase;
21 22
22 import org.eclipse.core.resources.IFile; 23 import org.eclipse.core.resources.IFile;
23 24
24 import java.io.File; 25 import java.io.File;
25 26
26 public class BreakpointManagerTest extends TestCase { 27 public class BreakpointManagerTest extends TestCase {
27 28
28 private final class MockBreakpointManager extends BreakpointManager { 29 private final class MockBreakpointManager extends BreakpointManager {
29 30
30 public MockBreakpointManager() { 31 public MockBreakpointManager() {
31 super(null); 32 super(null);
32 } 33 }
33 34
34 @Override 35 @Override
35 protected String resolvePathToPackage(IFile resource, String filePath) { 36 protected String resolvePathToPackage(IFile resource, String filePath) {
36 String packages = "{\"packages\":{\"unittest\": [\"/dart/unittest/lib\"]," 37 String packages = "{\"packages\":{\"unittest\": [\"/dart/unittest/lib\"],"
37 + "\"foo.bar.baz\": [\"/src/foo/bar/baz/lib\", \"/gen/foo/bar/baz\"]}} "; 38 + "\"foo.bar.baz\": [\"/src/foo/bar/baz/lib\", \"/gen/foo/bar/baz\"]}} ";
38 ExplicitPackageUriResolver resolver = new ExplicitPackageUriResolverTest.M ockExplicitPackageUriResolver( 39 ExplicitPackageUriResolver resolver = new ExplicitPackageUriResolverTest.M ockExplicitPackageUriResolver(
39 new File("root"), 40 new File("root"),
40 packages); 41 packages);
41 return resolver.resolvePathToPackage(filePath); 42 return resolver.resolvePathToPackage(filePath);
42 } 43 }
43 44
44 } 45 }
45 46
46 public void test_getPackagePath() { 47 public void test_getPackagePath() {
47 MockBreakpointManager manager = new MockBreakpointManager(); 48 if (!DartCore.isWindows()) {
48 49 String path = manager.getPackagePath(
49 String path = manager.getPackagePath("baz/lib/myLib.dart", null); 50 createFile("/baz/lib/myLib.dart").getAbsolutePath(),
50 assertNotNull(path); 51 null);
51 assertEquals("foo.bar.baz/myLib.dart", path); 52 assertNotNull(path);
52 path = manager.getPackagePath("baz/src/myLib.dart", null); 53 assertEquals("foo.bar.baz/myLib.dart", path);
53 assertNull(path); 54 path = manager.getPackagePath(createFile("/baz/src/myLib.dart").getAbsolut ePath(), null);
54 path = manager.getPackagePath("bar/baz/lib/util/util.dart", null); 55 assertNull(path);
55 assertNotNull(path); 56 path = manager.getPackagePath(
56 assertEquals("foo.bar.baz/util/util.dart", path); 57 createFile("/bar/baz/lib/util/util.dart").getAbsolutePath(),
58 null);
59 assertNotNull(path);
60 assertEquals("foo.bar.baz/util/util.dart", path);
61 }
57 } 62 }
58 63
59 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698