LEFT | RIGHT |
1 // Copyright 2007 Google Inc. All Rights Reserved | 1 // Copyright 2007 Google Inc. All Rights Reserved |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 false); | 189 false); |
190 | 190 |
191 } | 191 } |
192 | 192 |
193 public void testPartialScript() throws Exception { | 193 public void testPartialScript() throws Exception { |
194 PluginMeta meta = new PluginMeta(); | 194 PluginMeta meta = new PluginMeta(); |
195 PluginCompiler compiler = new PluginCompiler(new TestBuildInfo(), meta, mq); | 195 PluginCompiler compiler = new PluginCompiler(new TestBuildInfo(), meta, mq); |
196 compiler.setMessageContext(mc); | 196 compiler.setMessageContext(mc); |
197 Dom html = new Dom(htmlFragment(fromString("<script>{</script>"))); | 197 Dom html = new Dom(htmlFragment(fromString("<script>{</script>"))); |
198 compiler.addInput(new AncestorChain<Dom>(html)); | 198 compiler.addInput(AncestorChain.instance(html)); |
199 | 199 |
200 boolean passed = compiler.run(); | 200 boolean passed = compiler.run(); |
201 assertFalse(passed); | 201 assertFalse(passed); |
202 | 202 |
203 assertMessage( | 203 assertMessage( |
204 MessageType.END_OF_FILE, MessageLevel.ERROR, | 204 MessageType.END_OF_FILE, MessageLevel.ERROR, |
205 FilePosition.instance(is, 1, 9, 9, 1)); | 205 FilePosition.instance(is, 1, 9, 9, 1)); |
206 } | 206 } |
207 | 207 |
208 private void execGadget(String gadgetSpec, String tests, boolean valija) | 208 private void execGadget(String gadgetSpec, String tests, boolean valija) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 new RhinoTestBed.Input(getClass(), "console-stubs.js"), | 243 new RhinoTestBed.Input(getClass(), "console-stubs.js"), |
244 // Initialize the DOM | 244 // Initialize the DOM |
245 new RhinoTestBed.Input( | 245 new RhinoTestBed.Input( |
246 // Document not defined until window.location set. | 246 // Document not defined until window.location set. |
247 "location = '" + htmlStubUrl + "';\n", | 247 "location = '" + htmlStubUrl + "';\n", |
248 "dom"), | 248 "dom"), |
249 // Make the assertTrue, etc. functions available to javascript | 249 // Make the assertTrue, etc. functions available to javascript |
250 new RhinoTestBed.Input( | 250 new RhinoTestBed.Input( |
251 getClass(), "../../../../js/jsunit/2.2/jsUnitCore.js"), | 251 getClass(), "../../../../js/jsunit/2.2/jsUnitCore.js"), |
252 // Plugin Framework | 252 // Plugin Framework |
| 253 new RhinoTestBed.Input( |
| 254 getClass(), "../../../../js/json_sans_eval/json_sans_eval.js"), |
253 new RhinoTestBed.Input(getClass(), "../cajita.js"), | 255 new RhinoTestBed.Input(getClass(), "../cajita.js"), |
254 new RhinoTestBed.Input( | 256 new RhinoTestBed.Input( |
255 "___.setLogFunc(function(s, opt_stop) { console.log(s); });", | 257 "___.setLogFunc(function(s, opt_stop) { console.log(s); });", |
256 "setLogFunc-setup"), | 258 "setLogFunc-setup"), |
257 new RhinoTestBed.Input( | 259 new RhinoTestBed.Input( |
258 "var valijaMaker = {};\n" + | 260 "var valijaMaker = {};\n" + |
259 "var testImports = ___.copy(___.sharedImports);\n" + | 261 "var testImports = ___.copy(___.sharedImports);\n" + |
260 "testImports.loader = {\n" + | 262 "testImports.loader = {\n" + |
261 " provide: ___.frozenFunc(\n" + | 263 " provide: ___.frozenFunc(\n" + |
262 " function(v) { valijaMaker = v; })\n" + | 264 " function(v) { valijaMaker = v; })\n" + |
(...skipping 16 matching lines...) Expand all Loading... |
279 } catch (Exception e) { | 281 } catch (Exception e) { |
280 System.out.println("Compiled gadget: \n" + staticHtml + "\n" + js); | 282 System.out.println("Compiled gadget: \n" + staticHtml + "\n" + js); |
281 throw e; | 283 throw e; |
282 } catch (Error e) { | 284 } catch (Error e) { |
283 System.out.println("Compiled gadget: \n" + staticHtml + "\n" + js); | 285 System.out.println("Compiled gadget: \n" + staticHtml + "\n" + js); |
284 throw e; | 286 throw e; |
285 } | 287 } |
286 } | 288 } |
287 } | 289 } |
288 } | 290 } |
LEFT | RIGHT |