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

Side by Side Diff: editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/builder/HtmlWarningCodeTest.java

Issue 595513003: Version 1.7.0-dev.3.3 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 6 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
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
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 assertErrorLocation(errors.get(0), "other.dart"); 68 assertErrorLocation(errors.get(0), "other.dart");
69 } 69 }
70 70
71 @Override 71 @Override
72 protected void setUp() throws Exception { 72 protected void setUp() throws Exception {
73 sourceFactory = new SourceFactory(new FileUriResolver()); 73 sourceFactory = new SourceFactory(new FileUriResolver());
74 context = new AnalysisContextImpl(); 74 context = new AnalysisContextImpl();
75 context.setSourceFactory(sourceFactory); 75 context.setSourceFactory(sourceFactory);
76 } 76 }
77 77
78 @Override
79 protected void tearDown() throws Exception {
80 sourceFactory = null;
81 context = null;
82 contents = null;
83 errors = null;
84 super.tearDown();
85 }
86
78 private void assertErrorLocation(AnalysisError error, int expectedOffset, int expectedLength) { 87 private void assertErrorLocation(AnalysisError error, int expectedOffset, int expectedLength) {
79 assertEquals(error.toString(), expectedOffset, error.getOffset()); 88 assertEquals(error.toString(), expectedOffset, error.getOffset());
80 assertEquals(error.toString(), expectedLength, error.getLength()); 89 assertEquals(error.toString(), expectedLength, error.getLength());
81 } 90 }
82 91
83 private void assertErrorLocation(AnalysisError error, String expectedString) { 92 private void assertErrorLocation(AnalysisError error, String expectedString) {
84 assertErrorLocation(error, contents.indexOf(expectedString), expectedString. length()); 93 assertErrorLocation(error, contents.indexOf(expectedString), expectedString. length());
85 } 94 }
86 95
87 private void verify(String contents, ErrorCode... expectedErrorCodes) throws E xception { 96 private void verify(String contents, ErrorCode... expectedErrorCodes) throws E xception {
88 this.contents = contents; 97 this.contents = contents;
89 TestSource source = new TestSource(createFile("/test.html"), contents); 98 TestSource source = new TestSource(createFile("/test.html"), contents);
90 ChangeSet changeSet = new ChangeSet(); 99 ChangeSet changeSet = new ChangeSet();
91 changeSet.addedSource(source); 100 changeSet.addedSource(source);
92 context.applyChanges(changeSet); 101 context.applyChanges(changeSet);
93 102
94 HtmlUnitBuilder builder = new HtmlUnitBuilder(context); 103 HtmlUnitBuilder builder = new HtmlUnitBuilder(context);
95 builder.buildHtmlElement( 104 builder.buildHtmlElement(
96 source, 105 source,
97 context.getModificationStamp(source), 106 context.getModificationStamp(source),
98 context.parseHtmlUnit(source)); 107 context.parseHtmlUnit(source));
99 108
100 GatheringErrorListener errorListener = new GatheringErrorListener(); 109 GatheringErrorListener errorListener = new GatheringErrorListener();
101 errorListener.addAll(builder.getErrorListener()); 110 errorListener.addAll(builder.getErrorListener());
102 errorListener.assertErrorsWithCodes(expectedErrorCodes); 111 errorListener.assertErrorsWithCodes(expectedErrorCodes);
103 errors = errorListener.getErrors(); 112 errors = errorListener.getErrors();
104 } 113 }
105 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698