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

Function test

test/unit/test-viewer.js:1400–1406  ·  view source on GitHub ↗

* Tests trust determination by origin. * * @param {string} origin URL under test. * @param {boolean} toBeTrusted The expected outcome. * @param {boolean=} opt_inWebView Whether doc is in a web view.

(origin, toBeTrusted, opt_inWebView)

Source from the content-addressed store, hash-verified

1398 * @param {boolean=} opt_inWebView Whether doc is in a web view.
1399 */
1400 function test(origin, toBeTrusted, opt_inWebView) {
1401 it('testing ' + origin, () => {
1402 const viewer = new ViewerImpl(ampdoc);
1403 viewer.isWebviewEmbedded_ = !!opt_inWebView;
1404 expect(viewer.isTrustedViewerOrigin_(origin)).to.equal(toBeTrusted);
1405 });
1406 }
1407
1408 describe('should trust trusted viewer origins', () => {
1409 test('https://google.com', true);

Callers 3

test-viewer.jsFile · 0.70
setupJsonFetchInitFunction · 0.50
testElementR1Function · 0.50

Calls 3

expectFunction · 0.85
itFunction · 0.50

Tested by

no test coverage detected