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

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

Issue 1111603002: Added ability to register new hosts using GCD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host-list-delete
Patch Set: unit test fix Created 5 years, 8 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/host_list_api_impl_unittest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/crd/js/mock_host_list_api.js
diff --git a/remoting/webapp/crd/js/mock_host_list_api.js b/remoting/webapp/crd/js/mock_host_list_api.js
index 1d9b151b6b111f41e27aee311637af685e8eb037..3f2fb1fc13f431593e23468f4a299120bc987d2e 100644
--- a/remoting/webapp/crd/js/mock_host_list_api.js
+++ b/remoting/webapp/crd/js/mock_host_list_api.js
@@ -18,11 +18,18 @@ var remoting = remoting || {};
*/
remoting.MockHostListApi = function() {
/**
- * The auth code for the |register| method to return, or null if it
- * should fail.
+ * The auth code value for the |register| method to return, or null
+ * if it should fail.
* @type {?string}
*/
- this.registerResult = null;
+ this.authCodeFromRegister = null;
+
+ /**
+ * The email value for the |register| method to return, or null if
+ * it should fail.
+ * @type {?string}
+ */
+ this.emailFromRegister = null;
/** @type {Array<remoting.Host>} */
this.hosts = [
@@ -50,13 +57,16 @@ remoting.MockHostListApi = function() {
/** @override */
remoting.MockHostListApi.prototype.register = function(
newHostId, hostName, publicKey, hostClientId) {
- if (this.registerResult === null) {
+ if (this.authCodeFromRegister === null || this.emailFromRegister === null) {
return Promise.reject(
new remoting.Error(
remoting.Error.Tag.REGISTRATION_FAILED,
'MockHostListApi.register'));
} else {
- return Promise.resolve(this.registerResult);
+ return Promise.resolve({
+ authCode: this.authCodeFromRegister,
+ email: this.emailFromRegister
+ });
}
};
@@ -82,6 +92,7 @@ remoting.MockHostListApi.prototype.put =
return new Promise(function(resolve, reject) {
var onTokenValid = function() {
for (var i = 0; i < that.hosts.length; ++i) {
+ /** type {remoting.Host} */
var host = that.hosts[i];
if (host.hostId == hostId) {
host.hostName = hostName;
« no previous file with comments | « remoting/webapp/crd/js/host_list_api_impl_unittest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698