MCPcopy
hub / github.com/ampproject/amphtml / createCrypto

Function createCrypto

test/unit/test-crypto.js:106–123  ·  view source on GitHub ↗
(win)

Source from the content-addressed store, hash-verified

104 }
105
106 function createCrypto(win) {
107 if (!win.document) {
108 win.document = env.win.document;
109 }
110 win.performance = new FakePerformance(win);
111 installDocService(win, /* isSingleDoc */ true);
112 installExtensionsService(win);
113 const extensions = Services.extensionsFor(win);
114 env.sandbox
115 .stub(extensions, 'preloadExtension')
116 .callsFake((extensionId) => {
117 expect(extensionId).to.equal('amp-crypto-polyfill');
118 installCryptoPolyfill(win);
119 return Promise.resolve();
120 });
121
122 return new Crypto(win);
123 }
124
125 function isModernChrome() {
126 const platform = new Platform(window);

Callers 2

testSuiteFunction · 0.85
test-crypto.jsFile · 0.85

Calls 5

installDocServiceFunction · 0.90
installExtensionsServiceFunction · 0.90
installCryptoPolyfillFunction · 0.90
expectFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected