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

Access experiment cleanup #1964

Merged
merged 1 commit into from
Feb 12, 2016
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions extensions/amp-access/0.1/amp-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ const AccessType = {
/** @const */
const TAG = 'AmpAccess';

/** @const */
const ANALYTICS_EXPERIMENT = 'amp-access-analytics';

/** @const {number} */
const VIEW_TIMEOUT = 2000;

Expand All @@ -93,11 +90,8 @@ export class AccessService {
installStyles(this.win.document, $CSS$, () => {});

/** @const @private {boolean} */
this.isExperimentOn_ = true;

/** @const @private {boolean} */
this.isAnalyticsExperimentOn_ = (this.isExperimentOn_ &&
isExperimentOn(this.win, ANALYTICS_EXPERIMENT));
this.isAnalyticsExperimentOn_ = isExperimentOn(
this.win, 'amp-access-analytics');

const accessElement = document.getElementById('amp-access');

Expand Down Expand Up @@ -242,10 +236,6 @@ export class AccessService {
* @private
*/
start_() {
if (!this.isExperimentOn_) {
log.info(TAG, 'Access experiment is off: ', EXPERIMENT);
return this;
}
if (!this.enabled_) {
log.info(TAG, 'Access is disabled - no "id=amp-access" element');
return this;
Expand Down
10 changes: 1 addition & 9 deletions extensions/amp-access/0.1/test/test-amp-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,13 @@ describe('AccessService', () => {
}).to.throw(/Unknown access type/);
});

it('should start when experiment is on and enabled', () => {
it('should start when enabled', () => {
element.textContent = JSON.stringify({
'authorization': 'https://acme.com/a',
'pingback': 'https://acme.com/p',
'login': 'https://acme.com/l'
});
const service = new AccessService(window);
service.isExperimentOn_ = true;
service.startInternal_ = sandbox.spy();
service.start_();
expect(service.startInternal_.callCount).to.equal(1);
Expand All @@ -186,7 +185,6 @@ describe('AccessService', () => {
'login': 'https://acme.com/l'
});
const service = new AccessService(window);
service.isExperimentOn_ = true;
service.buildLoginUrl_ = sandbox.spy();
service.runAuthorization_ = sandbox.spy();
service.scheduleView_ = sandbox.spy();
Expand All @@ -206,7 +204,6 @@ describe('AccessService', () => {
'login': 'https://acme.com/l'
});
const service = new AccessService(window);
service.isExperimentOn_ = true;
expect(service.pubOrigin_).to.exist;
expect(service.pubOrigin_).to.match(/^http.*/);
});
Expand Down Expand Up @@ -259,7 +256,6 @@ describe('AccessService authorization', () => {
document.body.appendChild(elementOff);

service = new AccessService(window);
service.isExperimentOn_ = true;

sandbox.stub(service.resources_, 'mutateElement',
(unusedElement, mutator) => {
Expand Down Expand Up @@ -463,7 +459,6 @@ describe('AccessService applyAuthorizationToElement_', () => {
document.body.appendChild(elementOff);

service = new AccessService(window);
service.isExperimentOn_ = true;

mutateElementStub = sandbox.stub(service.resources_, 'mutateElement',
(unusedElement, mutator) => {
Expand Down Expand Up @@ -602,7 +597,6 @@ describe('AccessService pingback', () => {
document.documentElement.classList.remove('amp-access-error');

service = new AccessService(window);
service.isExperimentOn_ = true;

xhrMock = sandbox.mock(service.xhr_);

Expand Down Expand Up @@ -917,7 +911,6 @@ describe('AccessService login', () => {
document.documentElement.classList.remove('amp-access-error');

service = new AccessService(window);
service.isExperimentOn_ = true;

const cid = {
get: () => {}
Expand Down Expand Up @@ -1098,7 +1091,6 @@ describe('AccessService type=other', () => {
document.documentElement.classList.remove('amp-access-error');

service = new AccessService(window);
service.isExperimentOn_ = true;

service.vsync_ = {
mutate: callback => {
Expand Down