OLD | NEW |
(Empty) | |
| 1 dart_library.library('lib/html/cross_domain_iframe_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'unittest' |
| 4 ], function load__cross_domain_iframe_test(exports, dart_sdk, unittest) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const html = dart_sdk.html; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const unittest$ = unittest.unittest; |
| 11 const src__matcher__expect = unittest.src__matcher__expect; |
| 12 const src__matcher__core_matchers = unittest.src__matcher__core_matchers; |
| 13 const cross_domain_iframe_test = Object.create(null); |
| 14 let MessageEventTodynamic = () => (MessageEventTodynamic = dart.constFn(dart.f
unctionType(dart.dynamic, [html.MessageEvent])))(); |
| 15 let MessageEventTodynamic$ = () => (MessageEventTodynamic$ = dart.constFn(dart
.definiteFunctionType(dart.dynamic, [html.MessageEvent])))(); |
| 16 let MessageEventTobool = () => (MessageEventTobool = dart.constFn(dart.definit
eFunctionType(core.bool, [html.MessageEvent])))(); |
| 17 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 18 cross_domain_iframe_test.main = function() { |
| 19 unittest$.test('cross_domain_iframe', dart.fn(() => { |
| 20 let uri = core.Uri.parse(html.window[dartx.location][dartx.href]); |
| 21 let crossOriginPort = core.int.parse(uri.queryParameters[dartx.get]('cross
OriginPort')); |
| 22 let crossOrigin = dart.str`${uri.scheme}://${uri.host}:${crossOriginPort}`
; |
| 23 let crossOriginUrl = dart.str`${crossOrigin}/root_dart/tests/html/cross_do
main_iframe_script.html`; |
| 24 let iframe = html.IFrameElement.new(); |
| 25 iframe[dartx.src] = crossOriginUrl; |
| 26 html.document[dartx.body][dartx.append](iframe); |
| 27 html.window[dartx.onMessage].where(dart.fn(event => event[dartx.origin] ==
crossOrigin, MessageEventTobool())).first.then(dart.dynamic)(MessageEventTodyna
mic()._check(unittest$.expectAsync(dart.fn(event => { |
| 28 src__matcher__expect.expect(event[dartx.data], src__matcher__core_matche
rs.equals('foobar')); |
| 29 src__matcher__expect.expect(event[dartx.source], src__matcher__core_matc
hers.isNotNull); |
| 30 }, MessageEventTodynamic$())))); |
| 31 }, VoidTodynamic())); |
| 32 }; |
| 33 dart.fn(cross_domain_iframe_test.main, VoidTodynamic()); |
| 34 // Exports: |
| 35 exports.cross_domain_iframe_test = cross_domain_iframe_test; |
| 36 }); |
OLD | NEW |