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

Side by Side Diff: LayoutTests/dart/dom/HiddenDom2.dart

Issue 9188009: Things to unfork. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 8 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
« no previous file with comments | « LayoutTests/dart/dom/HiddenDom1-expected.txt ('k') | LayoutTests/dart/dom/HiddenDom2.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #import('../../../../../dart/client/testing/unittest/unittest.dart');
2 #import('dart:html');
3
4 // Test that the dart:html API does not leak native jsdom methods:
5 // appendChild operation.
6
7 main() {
8 forLayoutTests();
9
10 test('test1', () {
11 document.body.elements.add(new Element.html(@'''
12 <div id='div1'>
13 Hello World!
14 </div>'''));
15 Element e = document.query('#div1');
16 Element e2 = new Element.html(@"<div id='xx'>XX</div>");
17 Expect.isTrue(e != null);
18
19 checkNoSuchMethod(() { confuse(e).appendChild(e2); });
20
21 });
22 }
23
24 class Decoy {
25 void appendChild(x) { throw 'dead code'; }
26 }
27
28 confuse(x) => opaqueTrue() ? x : (opaqueTrue() ? new Object() : new Decoy());
29
30 /** Returns [:true:], but in a way that confuses the compiler. */
31 opaqueTrue() => true; // Expand as needed.
32
33 checkNoSuchMethod(action()) {
34 var ex = null;
35 bool threw = false;
36 try {
37 action();
38 } catch (var e) {
39 threw = true;
40 ex = e;
41 }
42 if (!threw)
43 Expect.fail('Action should have thrown exception');
44
45 Expect.isTrue(ex is NoSuchMethodException, 'ex is NoSuchMethodException');
46 }
OLDNEW
« no previous file with comments | « LayoutTests/dart/dom/HiddenDom1-expected.txt ('k') | LayoutTests/dart/dom/HiddenDom2.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698