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

Side by Side Diff: LayoutTests/dart/dom/HiddenDom1.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/HTMLElementTest-expected.txt ('k') | LayoutTests/dart/dom/HiddenDom1.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 // onfocus setter.
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 Expect.isTrue(e != null);
17
18 checkNoSuchMethod(() { confuse(e).onfocus = null; });
19 });
20
21 }
22
23 class Decoy {
24 void set onfocus(x) { throw 'dead code'; }
25 }
26
27 confuse(x) => opaqueTrue() ? x : (opaqueTrue() ? new Object() : new Decoy());
28
29 /** Returns [:true:], but in a way that confuses the compiler. */
30 opaqueTrue() => true; // Expand as needed.
31
32 checkNoSuchMethod(action()) {
33 var ex = null;
34 try {
35 action();
36 } catch (var e) {
37 ex = e;
38 }
39 if (ex === null)
40 Expect.fail('Action should have thrown exception');
41
42 Expect.isTrue(ex is NoSuchMethodException, 'ex is NoSuchMethodException');
43 }
OLDNEW
« no previous file with comments | « LayoutTests/dart/dom/HTMLElementTest-expected.txt ('k') | LayoutTests/dart/dom/HiddenDom1.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698