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

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

Issue 1094133003: Added (incomplete) implementation of HostListApi using GCD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcd-client-fix
Patch Set: for submit 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.js ('k') | remoting/webapp/crd/js/plugin_settings.js » ('j') | 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 b21462db2536f320fc3c66ab659f947cbe48f678..1d9b151b6b111f41e27aee311637af685e8eb037 100644
--- a/remoting/webapp/crd/js/mock_host_list_api.js
+++ b/remoting/webapp/crd/js/mock_host_list_api.js
@@ -52,7 +52,9 @@ remoting.MockHostListApi.prototype.register = function(
newHostId, hostName, publicKey, hostClientId) {
if (this.registerResult === null) {
return Promise.reject(
- new remoting.Error(remoting.Error.Tag.REGISTRATION_FAILED));
+ new remoting.Error(
+ remoting.Error.Tag.REGISTRATION_FAILED,
+ 'MockHostListApi.register'));
} else {
return Promise.resolve(this.registerResult);
}
@@ -61,13 +63,18 @@ remoting.MockHostListApi.prototype.register = function(
/** @override */
remoting.MockHostListApi.prototype.get = function() {
var that = this;
- new Promise(function(resolve, reject) {
+ return new Promise(function(resolve, reject) {
remoting.mockIdentity.validateTokenAndCall(
resolve, remoting.Error.handler(reject), [that.hosts]);
});
};
-/** @override */
+/**
+ * @override
+ * @param {string} hostId
+ * @param {string} hostName
+ * @param {string} hostPublicKey
+ */
remoting.MockHostListApi.prototype.put =
function(hostId, hostName, hostPublicKey) {
/** @type {remoting.MockHostListApi} */
@@ -91,7 +98,10 @@ remoting.MockHostListApi.prototype.put =
});
};
-/** @override */
+/**
+ * @override
+ * @param {string} hostId
+ */
remoting.MockHostListApi.prototype.remove = function(hostId) {
/** @type {remoting.MockHostListApi} */
var that = this;
@@ -116,6 +126,6 @@ remoting.MockHostListApi.prototype.remove = function(hostId) {
* @param {boolean} active
*/
remoting.MockHostListApi.setActive = function(active) {
- remoting.hostListApi = active ? new remoting.MockHostListApi()
- : new remoting.HostListApiImpl();
+ remoting.HostListApi.setInstance(
+ active ? new remoting.MockHostListApi() : null);
};
« no previous file with comments | « remoting/webapp/crd/js/host_list_api_impl.js ('k') | remoting/webapp/crd/js/plugin_settings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698