Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix friendly embedding on amp-ad, and reenable test-amp-ad-fake.js #22504

Merged
merged 5 commits into from May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc
Expand Up @@ -37,6 +37,7 @@
"deprecated",
"export",
"final",
"nocollapse",
"package",
"restricted",
"suppress",
Expand Down
1 change: 1 addition & 0 deletions extensions/amp-bind/0.1/bind-impl.js
Expand Up @@ -207,6 +207,7 @@ export class Bind {
/**
* @param {!Window} embedWin
* @param {!../../../src/service/ampdoc-impl.AmpDoc} ampdoc
* @nocollapse
rsimha marked this conversation as resolved.
Show resolved Hide resolved
*/
static installInEmbedWindow(embedWin, ampdoc) {
installServiceInEmbedScope(embedWin, 'bind', new Bind(ampdoc, embedWin));
Expand Down
1 change: 1 addition & 0 deletions extensions/amp-gwd-animation/0.1/amp-gwd-animation-impl.js
Expand Up @@ -190,6 +190,7 @@ export class AmpGwdRuntimeService {
/**
* @param {!Window} embedWin
* @param {!../../../src/service/ampdoc-impl.AmpDoc} ampdoc
* @nocollapse
*/
static installInEmbedWindow(embedWin, ampdoc) {
installServiceInEmbedScope(
Expand Down
1 change: 1 addition & 0 deletions src/service/action-impl.js
Expand Up @@ -281,6 +281,7 @@ export class ActionService {
/**
* @param {!Window} embedWin
* @param {!./ampdoc-impl.AmpDoc} ampdoc
* @nocollapse
*/
static installInEmbedWindow(embedWin, ampdoc) {
installServiceInEmbedScope(
Expand Down
1 change: 1 addition & 0 deletions src/service/hidden-observer-impl.js
Expand Up @@ -61,6 +61,7 @@ export class HiddenObserver {
/**
* @param {!Window} embedWin
* @param {!./ampdoc-impl.AmpDoc} ampdoc
* @nocollapse
*/
static installInEmbedWindow(embedWin, ampdoc) {
installServiceInEmbedScope(
Expand Down
1 change: 1 addition & 0 deletions src/service/navigation.js
Expand Up @@ -179,6 +179,7 @@ export class Navigation {
/**
* @param {!Window} embedWin
* @param {!./ampdoc-impl.AmpDoc} ampdoc
* @nocollapse
*/
static installInEmbedWindow(embedWin, ampdoc) {
installServiceInEmbedScope(
Expand Down
1 change: 1 addition & 0 deletions src/service/standard-actions-impl.js
Expand Up @@ -84,6 +84,7 @@ export class StandardActions {
/**
* @param {!Window} embedWin
* @param {!./ampdoc-impl.AmpDoc} ampdoc
* @nocollapse
*/
static installInEmbedWindow(embedWin, ampdoc) {
installServiceInEmbedScope(
Expand Down
1 change: 1 addition & 0 deletions src/service/timer-impl.js
Expand Up @@ -170,6 +170,7 @@ export class Timer {
/**
* @param {!Window} embedWin
* @param {!./ampdoc-impl.AmpDoc} unusedAmpDoc
* @nocollapse
*/
static installInEmbedWindow(embedWin, unusedAmpDoc) {
installServiceInEmbedScope(embedWin, TAG, new Timer(embedWin));
Expand Down
1 change: 1 addition & 0 deletions src/service/url-impl.js
Expand Up @@ -54,6 +54,7 @@ export class Url {
/**
* @param {!Window} embedWin
* @param {!./ampdoc-impl.AmpDoc} ampdoc
* @nocollapse
*/
static installInEmbedWindow(embedWin, ampdoc) {
installServiceInEmbedScope(
Expand Down
61 changes: 31 additions & 30 deletions test/integration/test-amp-ad-fake.js
Expand Up @@ -35,36 +35,38 @@ describe('A4A', function() {
},
() => {
// TODO(@zombifer, #21545): Unskip flaky test
it.skip('should layout amp-img, amp-pixel, amp-analytics', () => {
rsimha marked this conversation as resolved.
Show resolved Hide resolved
// See amp4test.js for creative content
return Promise.all([
RequestBank.withdraw('image'),
RequestBank.withdraw('pixel'),
RequestBank.withdraw('analytics'),
]).then(reqs => {
const imageReq = reqs[0];
const pixelReq = reqs[1];
const analyticsReq = reqs[2];
expect(imageReq.url).to.equal('/');
expect(pixelReq.url).to.equal('/foo?cid=');
expect(analyticsReq.url).to.match(/^\/bar\?/);
const queries = parseQueryString(
analyticsReq.url.substr('/bar'.length)
);
expect(queries).to.include({
title: 'AMP TEST', // ${title},
cid: '', // ${clientId(a)}
navTiming: '0', // ${navTiming(requestStart,requestStart)}
navType: '0', // ${navType}
navRedirectCount: '0', // ${navRedirectCount}
it.configure()
.skipFirefox()
.run('should layout amp-img, amp-pixel, amp-analytics', () => {
// See amp4test.js for creative content
return Promise.all([
RequestBank.withdraw('image'),
RequestBank.withdraw('pixel'),
RequestBank.withdraw('analytics'),
]).then(reqs => {
const imageReq = reqs[0];
const pixelReq = reqs[1];
const analyticsReq = reqs[2];
expect(imageReq.url).to.equal('/');
expect(pixelReq.url).to.equal('/foo?cid=');
expect(analyticsReq.url).to.match(/^\/bar\?/);
const queries = parseQueryString(
analyticsReq.url.substr('/bar'.length)
);
expect(queries).to.include({
title: 'AMP TEST', // ${title},
cid: '', // ${clientId(a)}
navTiming: '0', // ${navTiming(requestStart,requestStart)}
navType: '0', // ${navType}
navRedirectCount: '0', // ${navRedirectCount}
});
expect(queries['ampdocUrl']).to.contain(
'http://localhost:9876/amp4test/compose-doc?'
);
expect(queries['canonicalUrl']).to.equal('http://nonblocking.io/');
expect(queries['img']).to.contain('/deposit/image'); // ${htmlAttr(amp-img,src)}
});
expect(queries['ampdocUrl']).to.contain(
'http://localhost:9876/amp4test/compose-doc?'
);
expect(queries['canonicalUrl']).to.equal('http://nonblocking.io/');
expect(queries['img']).to.contain('/deposit/image'); // ${htmlAttr(amp-img,src)}
});
});
}
);

Expand All @@ -90,8 +92,7 @@ describe('A4A', function() {
`,
},
env => {
// TODO(@zombifer, #21545): Unskip flaky test
it.skip('p[text]', function*() {
it('p[text]', function*() {
// Wait for the amp-ad to construct its child iframe.
const ad = env.win.document.getElementById('i-amphtml-demo-id');
yield poll('amp-ad > iframe', () => ad.querySelector('iframe'));
Expand Down