From e22a03ed78cef9b706db71165de8fe08873b9f24 Mon Sep 17 00:00:00 2001 From: "weitaosu@chromium.org" Date: Sat, 5 Oct 2013 05:41:20 +0000 Subject: Add a Connect_Remote_Host test. The test is very similar to Connect_Local_Host. I also made two changes in the webapp: 1. Added a helper to map a host name to the host id 2. Add an id to the host name cell in the host list for easy retrieval in the test. BUG=134210 Review URL: https://codereview.chromium.org/26055002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227194 0039d316-1c4b-4281-b951-d872f2087c98 --- remoting/webapp/host_list.js | 15 +++++++++++++++ remoting/webapp/host_table_entry.js | 1 + 2 files changed, 16 insertions(+) (limited to 'remoting/webapp') diff --git a/remoting/webapp/host_list.js b/remoting/webapp/host_list.js index 7b24b3d..43ce092 100644 --- a/remoting/webapp/host_list.js +++ b/remoting/webapp/host_list.js @@ -141,6 +141,21 @@ remoting.HostList.prototype.getHostForId = function(hostId) { }; /** + * Get the host id corresponding to the specified host name. + * + * @param {string} hostName The name of the host. + * @return {string?} The host id, if a host with the given name exists. + */ +remoting.HostList.prototype.getHostIdForName = function(hostName) { + for (var i = 0; i < this.hosts_.length; ++i) { + if (this.hosts_[i].hostName == hostName) { + return this.hosts_[i].hostId; + } + } + return null; +}; + +/** * Query the Remoting Directory for the user's list of hosts. * * @param {function(boolean):void} onDone Callback invoked with true on success diff --git a/remoting/webapp/host_table_entry.js b/remoting/webapp/host_table_entry.js index fe9970b..779b4fc 100644 --- a/remoting/webapp/host_table_entry.js +++ b/remoting/webapp/host_table_entry.js @@ -72,6 +72,7 @@ remoting.HostTableEntry.prototype.createDom = function() { // Create the host name cell. var hostNameCell = /** @type {HTMLElement} */ document.createElement('div'); hostNameCell.classList.add('box-spacer'); + hostNameCell.id = 'host_' + this.host.hostId; tableRow.appendChild(hostNameCell); // Create the host rename cell. var editButton = /** @type {HTMLElement} */ document.createElement('span'); -- cgit v1.1