Chromium Code Reviews| Index: tests/html/cross_frame_test.dart |
| =================================================================== |
| --- tests/html/cross_frame_test.dart (revision 14114) |
| +++ tests/html/cross_frame_test.dart (working copy) |
| @@ -6,19 +6,30 @@ |
| main() { |
| useHtmlConfiguration(); |
| + var isWindow = new isInstanceOf<Window>('Window'); |
|
Siggi Cherem (dart-lang)
2012/10/26 00:44:51
is this now fixed in dart2js? it used to only work
gram
2012/10/26 22:26:27
No - as you can see from my comments below about n
|
| + var isLocalWindow = new isInstanceOf<LocalWindow>('LocalWindow'); |
| + var isLocation = new isInstanceOf<Location>('Location'); |
| + var isLocalLocation = new isInstanceOf<LocalLocation>('LocalLocation'); |
| + var isHistory = new isInstanceOf<History>('History'); |
| + var isLocalHistory = new isInstanceOf<LocalHistory>('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 +41,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 +69,6 @@ |
| expect(() => frameHistory.length, throws); |
| final frameParentHistory = iframe.contentWindow.parent.history; |
| - expect(frameParentHistory is LocalHistory); |
| + expect(frameParentHistory, isLocalHistory); |
| }); |
| } |