Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #15265 from ferjm/bug959227.fxa.uitests.revert
Browse files Browse the repository at this point in the history
Bug 959227 - Revert UITest changes introduced in bug 929388. r=zac
  • Loading branch information
Zac committed Jan 14, 2014
2 parents 38c4019 + ce1df1c commit c94e915
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 46 deletions.
35 changes: 6 additions & 29 deletions test_apps/uitest/js/API/identity.js
Expand Up @@ -13,10 +13,6 @@ function getIssuerName() {
return document.getElementById('issuer-name').value.trim();
}

function getWantIssuerName() {
return document.getElementById('wantIssuer-name').value.trim();
}

function unpackAssertion(assertion) {
var parts = assertion.split('.');
return {
Expand Down Expand Up @@ -58,14 +54,12 @@ function IdentityTests() {
};

this._setupCallbacks = function id__setupCallbacks() {
if (this._running) return;
var self = this;
var wantIssuer = getWantIssuerName();
try {
navigator.mozId.watch({
loggedInUser: null,

wantIssuer: wantIssuer,

onlogin: function(assertion) {
var unpacked = JSON.stringify(unpackAssertion(assertion), null, 2);
self.recordEvent('login', 'login',
Expand All @@ -78,41 +72,29 @@ function IdentityTests() {

onready: function() {
self.recordEvent('ready', 'ready');
self._enableButtons();
}

});
} catch (err) {
this.recordEvent('Error: ' + err, 'error');
}
};

this._enableButtons = function id__enableButtons() {
['t-request', 't-request-withOnCancel',
't-request-allowUnverified', 't-request-forceIssuer',
't-request-forceIssuer-allowUnverified',
't-request-wantIssuer',
't-logout'].forEach(function(selector) {
document.getElementById(selector).disabled = false;
});
};

/**
* Bind UI components
*/
this._bindEvents = function id__bindEvents() {
if (this._running) return;
var self = this;
var testElementHandlers = {
't-watch': function() {
self._setupCallbacks();
},
't-request': function() {
navigator.mozId.request();
},

't-request-withOnCancel': function() {
navigator.mozId.request({
oncancel: function() { self.recordEvent('cancel', 'cancel') }
navigator.mozId.request({oncancel: function() {
self.recordEvent('cancel', 'cancel');
}
});
},

Expand All @@ -135,12 +117,6 @@ function IdentityTests() {
});
},

't-request-wantIssuer': function() {
navigator.mozId.request({
wantIssuer: getWantIssuerName()
});
},

't-logout': function() {
navigator.mozId.logout();
}
Expand All @@ -153,6 +129,7 @@ function IdentityTests() {
};

this.init = function id_init() {
this._setupCallbacks();
this._bindEvents();
this._running = true;

Expand Down
25 changes: 8 additions & 17 deletions test_apps/uitest/tests_html/API/identity.html
Expand Up @@ -11,28 +11,19 @@

<div>
<p>Options</p>
<div><label for="issuer-name">Force Issuer:</label><input type="text"
id="issuer-name" value=""/></div>
<div><label for="wantIssuer-name">Want Issuer:</label><input type="text"
id="wantIssuer-name" value="firefox-accounts"/></div>
<div><label for="unverified-ok">Allow Unverified:</label><input type="checkbox"
id="unverified-ok"/></div>
<div><label for="issuer-name">Force Issuer:</label><input type="text" id="issuer-name" value=""/></div>
<div><label for="unverified-ok">Allow Unverified:</label><input type="checkbox" id="unverified-ok"/></div>
</div>

<div>
<p>Tests</p>
<p>Note: <code>forceIssuer</code> and <code>allowUnverified</code> are
deprecated. Use <code>wantIssuer</code> to trigger Firefox Accounts
flow.</p>
<ul>
<li><button id="t-watch">Watch</button></li>
<li><button id="t-request" disabled>Request</button> (Standard, verified email)</li>
<li><button id="t-request-withOnCancel" disabled>Request</button> (With <code>oncancel</code> handler)</li>
<li><button id="t-request-allowUnverified" disabled>Request</button> (Unverified)</li>
<li><button id="t-request-forceIssuer" disabled>Request</button> (Force issuer)</li>
<li><button id="t-request-forceIssuer-allowUnverified" disabled>Request</button> (Force issuer; unverified)</li>
<li><button id="t-request-wantIssuer" disabled>Request</button> (Want issuer (FXA))</li>
<li><button id="t-logout" disabled>Logout</button></li>
<li><button id="t-request">Request</button> (Standard, verified email)</li>
<li><button id="t-request-withOnCancel">Request</button> (With <code>oncancel</code> handler)</li>
<li><button id="t-request-allowUnverified">Request</button> (Unverified)</li>
<li><button id="t-request-forceIssuer">Request</button> (Force issuer)</li>
<li><button id="t-request-forceIssuer-allowUnverified">Request</button> (Force issuer; unverified)</li>
<li><button id="t-logout">Logout</button></li>
</ul>
</div>

Expand Down

0 comments on commit c94e915

Please sign in to comment.