Commit c980b7df authored by kelvinp@chromium.org's avatar kelvinp@chromium.org

Handle host need upgrade in Pin browser test

This CL handles create a helper method in browser_tests to dismiss the host-out-of-date warning if it is displayed.

BUG=393072

Review URL: https://codereview.chromium.org/389673003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283647 0039d316-1c4b-4281-b951-d872f2087c98
parent bdd509b4
...@@ -156,6 +156,21 @@ browserTest.onUIMode = function(expectedMode, opt_timeout) { ...@@ -156,6 +156,21 @@ browserTest.onUIMode = function(expectedMode, opt_timeout) {
}); });
}; };
browserTest.connectMe2Me = function() {
var AppMode = remoting.AppMode;
browserTest.clickOnControl('this-host-connect');
return browserTest.onUIMode(AppMode.CLIENT_HOST_NEEDS_UPGRADE).then(
function() {
// On fulfilled.
browserTest.clickOnControl('host-needs-update-connect-button');
}, function() {
// On time out.
return Promise.resolve();
}).then(function() {
return browserTest.onUIMode(AppMode.CLIENT_PIN_PROMPT);
});
}
browserTest.expectMe2MeError = function(errorTag) { browserTest.expectMe2MeError = function(errorTag) {
var AppMode = remoting.AppMode; var AppMode = remoting.AppMode;
var Timeout = browserTest.Timeout; var Timeout = browserTest.Timeout;
......
...@@ -21,13 +21,11 @@ browserTest.Cancel_PIN.prototype.run = function(data) { ...@@ -21,13 +21,11 @@ browserTest.Cancel_PIN.prototype.run = function(data) {
browserTest.expect(typeof data.pin == 'string'); browserTest.expect(typeof data.pin == 'string');
var AppMode = remoting.AppMode; var AppMode = remoting.AppMode;
browserTest.clickOnControl('this-host-connect'); browserTest.connectMe2Me().then(function() {
browserTest.onUIMode(AppMode.CLIENT_PIN_PROMPT).then(function() {
browserTest.clickOnControl('cancel-pin-entry-button'); browserTest.clickOnControl('cancel-pin-entry-button');
return browserTest.onUIMode(AppMode.HOME); return browserTest.onUIMode(AppMode.HOME);
}).then(function() { }).then(function() {
browserTest.clickOnControl('this-host-connect'); return browserTest.connectMe2Me()
return browserTest.onUIMode(AppMode.CLIENT_PIN_PROMPT);
}).then( }).then(
this.enterPin_.bind(this, data.pin) this.enterPin_.bind(this, data.pin)
).then(function() { ).then(function() {
......
...@@ -21,9 +21,7 @@ browserTest.Invalid_PIN.prototype.run = function(data) { ...@@ -21,9 +21,7 @@ browserTest.Invalid_PIN.prototype.run = function(data) {
browserTest.expect(typeof data.pin == 'string'); browserTest.expect(typeof data.pin == 'string');
// Connect to me2me Host. // Connect to me2me Host.
browserTest.clickOnControl('this-host-connect'); browserTest.connectMe2Me().then(
browserTest.onUIMode(remoting.AppMode.CLIENT_PIN_PROMPT).then(
this.enterPIN_.bind(this, data.pin) this.enterPIN_.bind(this, data.pin)
).then( ).then(
// Sleep for two seconds to allow the host backoff timer to reset. // Sleep for two seconds to allow the host backoff timer to reset.
......
...@@ -27,14 +27,14 @@ browserTest.Update_PIN.prototype.run = function(data) { ...@@ -27,14 +27,14 @@ browserTest.Update_PIN.prototype.run = function(data) {
'The new PIN and the old PIN cannot be the same'); 'The new PIN and the old PIN cannot be the same');
this.changePIN_(data.new_pin).then( this.changePIN_(data.new_pin).then(
this.connect_.bind(this) browserTest.connectMe2Me
).then( ).then(
this.enterPIN_.bind(this, data.old_pin, true /* expectError*/) this.enterPIN_.bind(this, data.old_pin, true /* expectError*/)
).then( ).then(
// Sleep for two seconds to allow for the login backoff logic to reset. // Sleep for two seconds to allow for the login backoff logic to reset.
base.Promise.sleep.bind(null, LOGIN_BACKOFF_WAIT) base.Promise.sleep.bind(null, LOGIN_BACKOFF_WAIT)
).then( ).then(
this.connect_.bind(this) browserTest.connectMe2Me
).then( ).then(
this.enterPIN_.bind(this, data.new_pin, false /* expectError*/) this.enterPIN_.bind(this, data.new_pin, false /* expectError*/)
).then( ).then(
...@@ -72,11 +72,6 @@ browserTest.Update_PIN.prototype.changePIN_ = function(newPin) { ...@@ -72,11 +72,6 @@ browserTest.Update_PIN.prototype.changePIN_ = function(newPin) {
}); });
}; };
browserTest.Update_PIN.prototype.connect_ = function() {
browserTest.clickOnControl('this-host-connect');
return browserTest.onUIMode(remoting.AppMode.CLIENT_PIN_PROMPT);
};
browserTest.Update_PIN.prototype.disconnect_ = function() { browserTest.Update_PIN.prototype.disconnect_ = function() {
var AppMode = remoting.AppMode; var AppMode = remoting.AppMode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment