1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 * @suppress {checkTypes}
8 * Browser test for the scenario below:
10 * 2. Connect with the new PIN.
11 * 3. Verify the connection succeeded.
12 * 4. Disconnect and reconnect with the old PIN.
13 * 5. Verify the connection failed.
19 browserTest.Update_PIN = function() {};
21 browserTest.Update_PIN.prototype.run = function(data) {
22 var LOGIN_BACKOFF_WAIT = 2000;
24 browserTest.expect(typeof data.new_pin == 'string');
25 browserTest.expect(typeof data.old_pin == 'string');
26 browserTest.expect(data.new_pin != data.old_pin,
27 'The new PIN and the old PIN cannot be the same');
29 this.changePIN_(data.new_pin).then(
30 browserTest.connectMe2Me
32 return browserTest.enterPIN(data.old_pin, true /* expectError*/);
34 // Sleep for two seconds to allow for the login backoff logic to reset.
35 base.Promise.sleep.bind(null, LOGIN_BACKOFF_WAIT)
37 browserTest.connectMe2Me
39 return browserTest.enterPIN_(data.new_pin, false /* expectError*/)
41 // Clean up the test by disconnecting and changing the PIN back
42 browserTest.disconnect
44 // The PIN must be restored regardless of success or failure.
45 this.changePIN_.bind(this, data.old_pin),
46 this.changePIN_.bind(this, data.old_pin)
55 browserTest.Update_PIN.prototype.changePIN_ = function(newPin) {
56 var AppMode = remoting.AppMode;
57 var HOST_RESTART_WAIT = 10000;
58 browserTest.clickOnControl('change-daemon-pin');
59 return browserTest.setupPIN(newPin);