| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * @suppress {checkTypes} | 7 * @suppress {checkTypes} |
| 8 * Browser test for the scenario below: | 8 * Browser test for the scenario below: |
| 9 * 1. Change the PIN. | 9 * 1. Change the PIN. |
| 10 * 2. Connect with the new PIN. | 10 * 2. Connect with the new PIN. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 this.changePIN_.bind(this, data.old_pin) | 46 this.changePIN_.bind(this, data.old_pin) |
| 47 ).then( | 47 ).then( |
| 48 // On fulfilled. | 48 // On fulfilled. |
| 49 browserTest.pass, | 49 browserTest.pass, |
| 50 // On rejected. | 50 // On rejected. |
| 51 browserTest.fail | 51 browserTest.fail |
| 52 ); | 52 ); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 browserTest.Update_PIN.prototype.changePIN_ = function(newPin) { | 55 browserTest.Update_PIN.prototype.changePIN_ = function(newPin) { |
| 56 var AppMode = remoting.AppMode; | |
| 57 var HOST_RESTART_WAIT = 10000; | |
| 58 | |
| 59 browserTest.clickOnControl('change-daemon-pin'); | 56 browserTest.clickOnControl('change-daemon-pin'); |
| 60 | 57 return browserTest.setupPIN(newPin); |
| 61 return browserTest.onUIMode(AppMode.HOST_SETUP_ASK_PIN).then(function() { | |
| 62 var onSetupDone = browserTest.onUIMode(AppMode.HOST_SETUP_DONE); | |
| 63 document.getElementById('daemon-pin-entry').value = newPin; | |
| 64 document.getElementById('daemon-pin-confirm').value = newPin; | |
| 65 browserTest.clickOnControl('daemon-pin-ok'); | |
| 66 return onSetupDone; | |
| 67 }).then(function() { | |
| 68 browserTest.clickOnControl('host-config-done-dismiss'); | |
| 69 // On Linux, we restart the host after changing the PIN, need to sleep | |
| 70 // for ten seconds before the host is ready for connection. | |
| 71 return base.Promise.sleep(HOST_RESTART_WAIT); | |
| 72 }); | |
| 73 }; | 58 }; |
| 74 | 59 |
| 75 browserTest.Update_PIN.prototype.disconnect_ = function() { | 60 browserTest.Update_PIN.prototype.disconnect_ = function() { |
| 76 var AppMode = remoting.AppMode; | 61 var AppMode = remoting.AppMode; |
| 77 | 62 |
| 78 remoting.disconnect(); | 63 remoting.disconnect(); |
| 79 | 64 |
| 80 return browserTest.onUIMode(AppMode.CLIENT_SESSION_FINISHED_ME2ME) | 65 return browserTest.onUIMode(AppMode.CLIENT_SESSION_FINISHED_ME2ME) |
| 81 .then(function() { | 66 .then(function() { |
| 82 var onHome = browserTest.onUIMode(AppMode.HOME); | 67 var onHome = browserTest.onUIMode(AppMode.HOME); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 95 return base.Promise.sleep(CONNECT_PIN_WAIT).then(function() { | 80 return base.Promise.sleep(CONNECT_PIN_WAIT).then(function() { |
| 96 browserTest.clickOnControl('pin-connect-button'); | 81 browserTest.clickOnControl('pin-connect-button'); |
| 97 }).then(function() { | 82 }).then(function() { |
| 98 if (expectError) { | 83 if (expectError) { |
| 99 return browserTest.expectMe2MeError(remoting.Error.INVALID_ACCESS_CODE); | 84 return browserTest.expectMe2MeError(remoting.Error.INVALID_ACCESS_CODE); |
| 100 } else { | 85 } else { |
| 101 return browserTest.expectMe2MeConnected(); | 86 return browserTest.expectMe2MeConnected(); |
| 102 } | 87 } |
| 103 }); | 88 }); |
| 104 }; | 89 }; |
| OLD | NEW |