| Index: tests/html/cross_frame_test.dart
|
| ===================================================================
|
| --- tests/html/cross_frame_test.dart (revision 14156)
|
| +++ tests/html/cross_frame_test.dart (working copy)
|
| @@ -6,19 +6,31 @@
|
| main() {
|
| useHtmlConfiguration();
|
|
|
| + var isWindow = predicate((x) => x is Window, 'is a Window');
|
| + var isLocalWindow = predicate((x) => x is LocalWindow, 'is a LocalWindow');
|
| + var isLocation = predicate((x) => x is Location, 'is a Location');
|
| + var isLocalLocation =
|
| + predicate((x) => x is LocalLocation, 'is a LocalLocation');
|
| + var isHistory = predicate((x) => x is History, 'is a History');
|
| + var isLocalHistory = predicate((x) => x is LocalHistory, 'is a LocalHistory');
|
| +
|
| final iframe = new Element.tag('iframe');
|
| document.body.nodes.add(iframe);
|
|
|
| test('window', () {
|
| - expect(window is LocalWindow);
|
| - expect(window.document == document);
|
| + expect(window, isLocalWindow);
|
| + expect(window.document, document);
|
| });
|
|
|
| test('iframe', () {
|
| final frameWindow = iframe.contentWindow;
|
| - expect(frameWindow is Window);
|
| - expect(frameWindow is! LocalWindow);
|
| - expect(frameWindow.parent is LocalWindow);
|
| + expect(frameWindow, isWindow);
|
| + //TODO(gram) The next test should be written as:
|
| + // expect(frameWindow, isNot(isLocalWindow));
|
| + // but that will cause problems now until is/is! work
|
| + // properly in dart2js instead of always returning true.
|
| + expect(frameWindow is! LocalWindow, isTrue);
|
| + expect(frameWindow.parent, isLocalWindow);
|
|
|
| // Ensure that the frame's document is inaccessible via window.
|
| expect(() => frameWindow.document, throws);
|
| @@ -30,23 +42,27 @@
|
| });
|
|
|
| test('location', () {
|
| - expect(window.location is LocalLocation);
|
| + expect(window.location, isLocalLocation);
|
| final frameLocation = iframe.contentWindow.location;
|
| - expect(frameLocation is Location);
|
| - expect(frameLocation is! LocalLocation);
|
| + expect(frameLocation, isLocation);
|
| + // TODO(gram) Similar to the above, the next test should be:
|
| + // expect(frameLocation, isNot(isLocalLocation));
|
| + expect(frameLocation is! LocalLocation, isTrue);
|
|
|
| expect(() => frameLocation.href, throws);
|
| expect(() => frameLocation.hash, throws);
|
|
|
| final frameParentLocation = iframe.contentWindow.parent.location;
|
| - expect(frameParentLocation is LocalLocation);
|
| + expect(frameParentLocation, isLocalLocation);
|
| });
|
|
|
| test('history', () {
|
| - expect(window.history is LocalHistory);
|
| + expect(window.history, isLocalHistory);
|
| final frameHistory = iframe.contentWindow.history;
|
| - expect(frameHistory is History);
|
| - expect(frameHistory is! LocalHistory);
|
| + expect(frameHistory, isHistory);
|
| + // See earlier comments.
|
| + //expect(frameHistory, isNot(isLocalHistory));
|
| + expect(frameHistory is! LocalHistory, isTrue);
|
|
|
| // Valid methods.
|
| frameHistory.forward();
|
| @@ -54,6 +70,6 @@
|
| expect(() => frameHistory.length, throws);
|
|
|
| final frameParentHistory = iframe.contentWindow.parent.history;
|
| - expect(frameParentHistory is LocalHistory);
|
| + expect(frameParentHistory, isLocalHistory);
|
| });
|
| }
|
|
|