Skip to content

Commit

Permalink
initial commit (ampproject#20833)
Browse files Browse the repository at this point in the history
  • Loading branch information
keithwrightbos authored Feb 13, 2019
1 parent 6831b63 commit f1fb33b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ export function resetSharedState() {
/** @type {string} */
const FORMAT_EXP = 'as-use-attr-for-format';

/** @type {string} */
const DELAY_NUMBER_EXP = 'adsense-ff-number-delay';

/** @final */
export class AmpAdNetworkAdsenseImpl extends AmpA4A {

Expand Down Expand Up @@ -232,7 +235,8 @@ export class AmpAdNetworkAdsenseImpl extends AmpA4A {

/** @override */
delayAdRequestEnabled() {
return true;
return getExperimentBranch(
this.win, DELAY_NUMBER_EXP) == '21063207' ? 3 : true;
}

/** @override */
Expand Down Expand Up @@ -281,6 +285,10 @@ export class AmpAdNetworkAdsenseImpl extends AmpA4A {
Number(this.element.getAttribute('height')) > 0,
branches: ['21062003', '21062004'],
},
[DELAY_NUMBER_EXP]: {
isTrafficEligible: () => true,
branches: ['21063206', '21063207'],
},
});
const setExps = randomlySelectUnsetExperiments(this.win, experimentInfoMap);
Object.keys(setExps).forEach(expName =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,12 @@ describes.realWin('amp-ad-network-adsense-impl', {
describe('#delayAdRequestEnabled', () => {
it('should return true', () =>
expect(impl.delayAdRequestEnabled()).to.be.true);

it('should return 3 if in experiment', () => {
forceExperimentBranch(impl.win, 'adsense-ff-number-delay', '21063207');
impl.divertExperiments();
expect(impl.delayAdRequestEnabled()).to.equal(3);
});
});

describe('#preconnect', () => {
Expand Down

0 comments on commit f1fb33b

Please sign in to comment.