Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Unified Diff: remoting/webapp/crd/js/oauth2_api_impl.js

Issue 840023004: Implement mocks for identity and host-list, add a browser test to test the app in various failure m… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/crd/js/oauth2_api.js ('k') | remoting/webapp/js_proto/dom_proto.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/oauth2_api_impl.js
diff --git a/remoting/webapp/crd/js/oauth2_api.js b/remoting/webapp/crd/js/oauth2_api_impl.js
similarity index 91%
copy from remoting/webapp/crd/js/oauth2_api.js
copy to remoting/webapp/crd/js/oauth2_api_impl.js
index 2bc55f5391d18b5a52eb21c24e726e2c00790510..cf976e0293380cef0056eed2185069564f769a78 100644
--- a/remoting/webapp/crd/js/oauth2_api.js
+++ b/remoting/webapp/crd/js/oauth2_api_impl.js
@@ -12,21 +12,24 @@
/** @suppress {duplicate} */
var remoting = remoting || {};
-/** @constructor */
-remoting.OAuth2Api = function() {
+/**
+ * @constructor
+ * @implements {remoting.OAuth2Api}
+ */
+remoting.OAuth2ApiImpl = function() {
};
/** @private
* @return {string} OAuth2 token URL.
*/
-remoting.OAuth2Api.prototype.getOAuth2TokenEndpoint_ = function() {
+remoting.OAuth2ApiImpl.prototype.getOAuth2TokenEndpoint_ = function() {
return remoting.settings.OAUTH2_BASE_URL + '/token';
};
/** @private
* @return {string} OAuth2 userinfo API URL.
*/
-remoting.OAuth2Api.prototype.getOAuth2ApiUserInfoEndpoint_ = function() {
+remoting.OAuth2ApiImpl.prototype.getOAuth2ApiUserInfoEndpoint_ = function() {
return remoting.settings.OAUTH2_API_BASE_URL + '/v1/userinfo';
};
@@ -38,7 +41,7 @@ remoting.OAuth2Api.prototype.getOAuth2ApiUserInfoEndpoint_ = function() {
* @param {number} xhrStatus Status (HTTP response code) of the XMLHttpRequest.
* @return {remoting.Error} An error code to be raised.
*/
-remoting.OAuth2Api.prototype.interpretXhrStatus_ =
+remoting.OAuth2ApiImpl.prototype.interpretXhrStatus_ =
function(xhrStatus) {
// Return AUTHENTICATION_FAILED by default, so that the user can try to
// recover from an unexpected failure by signing in again.
@@ -68,7 +71,7 @@ remoting.OAuth2Api.prototype.interpretXhrStatus_ =
* @param {string} refreshToken OAuth2 refresh token to be redeemed.
* @return {void} Nothing.
*/
-remoting.OAuth2Api.prototype.refreshAccessToken = function(
+remoting.OAuth2ApiImpl.prototype.refreshAccessToken = function(
onDone, onError, clientId, clientSecret, refreshToken) {
/** @param {XMLHttpRequest} xhr */
var onResponse = function(xhr) {
@@ -115,7 +118,7 @@ remoting.OAuth2Api.prototype.refreshAccessToken = function(
* @param {string} redirectUri Redirect URI used to obtain this code.
* @return {void} Nothing.
*/
-remoting.OAuth2Api.prototype.exchangeCodeForTokens = function(
+remoting.OAuth2ApiImpl.prototype.exchangeCodeForTokens = function(
onDone, onError, clientId, clientSecret, code, redirectUri) {
/** @param {XMLHttpRequest} xhr */
var onResponse = function(xhr) {
@@ -159,7 +162,7 @@ remoting.OAuth2Api.prototype.exchangeCodeForTokens = function(
* @param {string} token Access token.
* @return {void} Nothing.
*/
-remoting.OAuth2Api.prototype.getEmail = function(onDone, onError, token) {
+remoting.OAuth2ApiImpl.prototype.getEmail = function(onDone, onError, token) {
/** @param {XMLHttpRequest} xhr */
var onResponse = function(xhr) {
if (xhr.status == 200) {
@@ -192,7 +195,8 @@ remoting.OAuth2Api.prototype.getEmail = function(onDone, onError, token) {
* @param {string} token Access token.
* @return {void} Nothing.
*/
-remoting.OAuth2Api.prototype.getUserInfo = function(onDone, onError, token) {
+remoting.OAuth2ApiImpl.prototype.getUserInfo =
+ function(onDone, onError, token) {
/** @param {XMLHttpRequest} xhr */
var onResponse = function(xhr) {
if (xhr.status == 200) {
@@ -216,4 +220,4 @@ remoting.OAuth2Api.prototype.getUserInfo = function(onDone, onError, token) {
};
/** @type {remoting.OAuth2Api} */
-remoting.oauth2Api = new remoting.OAuth2Api();
+remoting.oauth2Api = new remoting.OAuth2ApiImpl();
« no previous file with comments | « remoting/webapp/crd/js/oauth2_api.js ('k') | remoting/webapp/js_proto/dom_proto.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698