(detectFeatures = false)
| 26 | const javascriptUrlPrefix = 'javascript'; |
| 27 | |
| 28 | function getPreconnectIframe(detectFeatures = false) { |
| 29 | return createIframePromise().then((iframe) => { |
| 30 | iframeClock = fakeTimers.withGlobal(iframe.win).install(); |
| 31 | if (detectFeatures) { |
| 32 | setPreconnectFeaturesForTesting(null); |
| 33 | } else { |
| 34 | setPreconnectFeaturesForTesting({ |
| 35 | preload: preloadSupported, |
| 36 | preconnect: preconnectSupported, |
| 37 | }); |
| 38 | } |
| 39 | |
| 40 | const platform = { |
| 41 | isSafari: () => !!isSafari, |
| 42 | }; |
| 43 | iframe.win.__AMP_SERVICES['platform'] = {obj: platform, ctor: Object}; |
| 44 | sandbox.stub(Services, 'platformFor').returns(platform); |
| 45 | |
| 46 | installPreconnectService(iframe.win); |
| 47 | preconnect = Services.preconnectFor(iframe.win); |
| 48 | |
| 49 | ampdoc = { |
| 50 | whenFirstVisible: () => visiblePromise, |
| 51 | }; |
| 52 | return iframe; |
| 53 | }); |
| 54 | } |
| 55 | |
| 56 | beforeEach(() => { |
| 57 | sandbox = env.sandbox; |
no test coverage detected