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

Side by Side Diff: tests/html/inner_frame_test.dart

Issue 10331009: Port two more tests to dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 | « tests/html/html.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #library('InnerFrameTest');
2 #import('../../lib/unittest/unittest.dart');
3 #import('../../lib/unittest/html_config.dart');
4 #import('dart:html');
5
6 main() {
7 if (window != window.top) {
8 // Child frame.
9
10 // The child's frame should not be able to access its parent's
11 // document.
12
13 // Check window.frameElement.
14 try {
15 var parentDocument = window.frameElement.document;
16 var div = parentDocument.$dom_createElement("div");
17 div.id = "illegalFrameElement";
18 parentDocument.body.nodes.add(div);
19 Expect.fail('Should not reach here.');
20 } catch (NoSuchMethodException e) {
21 // Expected.
22 }
23
24 // Check window.top.
25 try {
26 final top = window.top;
27 var parentDocument = top.document;
28 var div = parentDocument.$dom_createElement("div");
29 div.id = "illegalTop";
30 parentDocument.body.nodes.add(div);
31 Expect.fail('Should not reach here.');
32 } catch (var e) {
33 // Expected.
34 // TODO(vsm): Enforce this is a NoSuchMethodException.
35 }
36 return;
37 }
38
39 // Parent / test frame
40 useHtmlConfiguration();
41
42 final iframe = new Element.tag('iframe');
43 iframe.src = window.location.href;
44
45 asyncTest('prepare', 1, () {
46 iframe.on.load.add((e) => callbackDone());
47 document.body.nodes.add(iframe);
48 });
49
50 test('frameElement', () {
51 var div = document.query('#illegalFrameElement');
52
53 // Ensure that this parent frame was not modified by its child.
54 Expect.isNull(div);
55 });
56
57 test('top', () {
58 var div = document.query('#illegalTop');
59
60 // Ensure that this parent frame was not modified by its child.
61 Expect.isNull(div);
62 });
63 }
OLDNEW
« no previous file with comments | « tests/html/html.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698