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

Side by Side Diff: client/tests/client/dom/InnerFrameTest.dart

Issue 10191033: test renaming overhaul: step 4 client tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
OLDNEW
(Empty)
1 #library('InnerFrameTest');
2 #import('../../../../lib/unittest/unittest.dart');
3 #import('../../../../lib/unittest/dom_config.dart');
4 #import('dart:dom');
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.ownerDocument;
16 var div = parentDocument.createElement("div");
17 div.id = "illegalFrameElement";
18 parentDocument.body.appendChild(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.createElement("div");
29 div.id = "illegalTop";
30 parentDocument.body.appendChild(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 useDomConfiguration();
41
42 final iframe = document.createElement('iframe');
43 iframe.src = window.location.href;
44
45 asyncTest('prepare', 1, () {
46 iframe.addEventListener('load', (e) => callbackDone(), false);
47 document.body.appendChild(iframe);
48 });
49
50 test('frameElement', () {
51 var div = document.getElementById('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.getElementById('illegalTop');
59
60 // Ensure that this parent frame was not modified by its child.
61 Expect.isNull(div);
62 });
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698