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

Unified Diff: tests/html/inner_frame_test.dart

Issue 12385090: Further HTML test cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: tests/html/inner_frame_test.dart
diff --git a/tests/html/inner_frame_test.dart b/tests/html/inner_frame_test.dart
deleted file mode 100644
index 300192524e4df8cea01ad5aaeab17e8587c28a19..0000000000000000000000000000000000000000
--- a/tests/html/inner_frame_test.dart
+++ /dev/null
@@ -1,120 +0,0 @@
-library InnerFrameTest;
-import '../../pkg/unittest/lib/unittest.dart';
-import '../../pkg/unittest/lib/html_config.dart';
-import 'dart:html';
-
-main() {
- if (window != window.top) {
- // Child frame.
-
- // The child's frame should not be able to access its parent's
- // document.
-
- window.onMessage.listen((Event e) {
blois 2013/03/04 19:30:05 This test is horribly broken because of the nestin
- switch (e.data) {
- case 'frameElement': {
- // Check window.frameElement.
- try {
- var parentDocument = window.frameElement.document;
- var div = parentDocument.$dom_createElement("div");
- div.id = "illegalFrameElement";
- parentDocument.body.nodes.add(div);
- expect(false, isTrue, reason: 'Should not reach here.');
- } on NoSuchMethodError catch (e) {
- // Expected.
- window.top.postMessage('pass_frameElement', '*');
- } catch (e) {
- window.top.postMessage('fail_frameElement', '*');
- }
- return;
- }
- case 'top': {
- // Check window.top.
- try {
- final top = window.top;
- var parentDocument = top.document;
- var div = parentDocument.$dom_createElement("div");
- div.id = "illegalTop";
- parentDocument.body.nodes.add(div);
- expect(false, isTrue, reason: 'Should not reach here.');
- } on NoSuchMethodError catch (e) {
- // Expected.
- window.top.postMessage('pass_top', '*');
- } catch (e) {
- window.top.postMessage('fail_top', '*');
- }
- return;
- }
- case 'parent': {
- // Check window.parent.
- try {
- final parent = window.parent;
- var parentDocument = parent.document;
- var div = parentDocument.$dom_createElement("div");
- div.id = "illegalParent";
- parentDocument.body.nodes.add(div);
- expect(false, isTrue, reason: 'Should not reach here.');
- } on NoSuchMethodError catch (e) {
- // Expected.
- window.top.postMessage('pass_parent', '*');
- } catch (e) {
- window.top.postMessage('fail_parent', '*');
- }
- return;
- }
- }
- });
- }
-
- // Parent / test frame
- useHtmlConfiguration();
-
- final iframe = new Element.tag('iframe');
- iframe.src = window.location.href;
- var child;
-
- test('prepare', () {
- iframe.onLoad.listen(expectAsync1((e) { child = iframe.contentWindow;}));
- document.body.nodes.add(iframe);
- });
-
- final validate = (testName, verify) {
- final expectedVerify = expectAsync0(verify);
- window.onMessage.listen((e) {
- guardAsync(() {
- if (e.data == 'pass_$testName') {
- expectedVerify();
- }
- expect(e.data, isNot(equals('fail_$testName')));
- });
- });
- child.postMessage(testName, '*');
- };
-
- test('frameElement', () {
- validate('frameElement', () {
- var div = document.query('#illegalFrameElement');
-
- // Ensure that this parent frame was not modified by its child.
- expect(div, isNull);
- });
- });
-
- test('top', () {
- validate('top', () {
- var div = document.query('#illegalTop');
-
- // Ensure that this parent frame was not modified by its child.
- expect(div, isNull);
- });
- });
-
- test('parent', () {
- validate('parent', () {
- var div = document.query('#illegalParent');
-
- // Ensure that this parent frame was not modified by its child.
- expect(div, isNull);
- });
- });
-}

Powered by Google App Engine
This is Rietveld 408576698