OLD | NEW |
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 "<script src=\"dart.js\"/>", | 172 "<script src=\"dart.js\"/>", |
173 "</html>")); | 173 "</html>")); |
174 validate(element, s(l(v("bar"))), s("other.dart")); | 174 validate(element, s(l(v("bar"))), s("other.dart")); |
175 } | 175 } |
176 | 176 |
177 @Override | 177 @Override |
178 protected void setUp() throws Exception { | 178 protected void setUp() throws Exception { |
179 context = AnalysisContextFactory.contextWithCore(); | 179 context = AnalysisContextFactory.contextWithCore(); |
180 } | 180 } |
181 | 181 |
| 182 @Override |
| 183 protected void tearDown() throws Exception { |
| 184 context = null; |
| 185 super.tearDown(); |
| 186 } |
| 187 |
182 ExpectedLibrary l(ExpectedVariable... expectedVariables) { | 188 ExpectedLibrary l(ExpectedVariable... expectedVariables) { |
183 return new ExpectedLibrary(expectedVariables); | 189 return new ExpectedLibrary(expectedVariables); |
184 } | 190 } |
185 | 191 |
186 private HtmlElementImpl build(String contents) throws Exception { | 192 private HtmlElementImpl build(String contents) throws Exception { |
187 TestSource source = new TestSource(createFile("/test.html"), contents); | 193 TestSource source = new TestSource(createFile("/test.html"), contents); |
188 ChangeSet changeSet = new ChangeSet(); | 194 ChangeSet changeSet = new ChangeSet(); |
189 changeSet.addedSource(source); | 195 changeSet.addedSource(source); |
190 context.applyChanges(changeSet); | 196 context.applyChanges(changeSet); |
191 | 197 |
(...skipping 19 matching lines...) Expand all Loading... |
211 private void validate(HtmlElementImpl element, ExpectedScript... expectedScrip
ts) { | 217 private void validate(HtmlElementImpl element, ExpectedScript... expectedScrip
ts) { |
212 assertSame(context, element.getContext()); | 218 assertSame(context, element.getContext()); |
213 HtmlScriptElement[] scripts = element.getScripts(); | 219 HtmlScriptElement[] scripts = element.getScripts(); |
214 assertNotNull(scripts); | 220 assertNotNull(scripts); |
215 assertLength(expectedScripts.length, scripts); | 221 assertLength(expectedScripts.length, scripts); |
216 for (int scriptIndex = 0; scriptIndex < scripts.length; scriptIndex++) { | 222 for (int scriptIndex = 0; scriptIndex < scripts.length; scriptIndex++) { |
217 expectedScripts[scriptIndex].validate(scriptIndex, scripts[scriptIndex]); | 223 expectedScripts[scriptIndex].validate(scriptIndex, scripts[scriptIndex]); |
218 } | 224 } |
219 } | 225 } |
220 } | 226 } |
OLD | NEW |