| 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. Attempt to connect. | 9 * 1. Attempt to connect. |
| 10 * 2. Hit cancel at the PIN prompt. | 10 * 2. Hit cancel at the PIN prompt. |
| 11 * 3. Reconnect with the PIN. | 11 * 3. Reconnect with the PIN. |
| 12 * 4. Verify that the session is connected. | 12 * 4. Verify that the session is connected. |
| 13 */ | 13 */ |
| 14 | 14 |
| 15 'use strict'; | 15 'use strict'; |
| 16 | 16 |
| 17 /** @constructor */ | 17 /** @constructor */ |
| 18 browserTest.Cancel_PIN = function() {}; | 18 browserTest.Cancel_PIN = function() {}; |
| 19 | 19 |
| 20 browserTest.Cancel_PIN.prototype.run = function(data) { | 20 browserTest.Cancel_PIN.prototype.run = function(data) { |
| 21 browserTest.expect(typeof data.pin == 'string'); | 21 browserTest.expect(typeof data.pin == 'string'); |
| 22 | 22 |
| 23 var AppMode = remoting.AppMode; | 23 var AppMode = remoting.AppMode; |
| 24 browserTest.clickOnControl('this-host-connect'); | 24 browserTest.connectMe2Me().then(function() { |
| 25 browserTest.onUIMode(AppMode.CLIENT_PIN_PROMPT).then(function() { | |
| 26 browserTest.clickOnControl('cancel-pin-entry-button'); | 25 browserTest.clickOnControl('cancel-pin-entry-button'); |
| 27 return browserTest.onUIMode(AppMode.HOME); | 26 return browserTest.onUIMode(AppMode.HOME); |
| 28 }).then(function() { | 27 }).then(function() { |
| 29 browserTest.clickOnControl('this-host-connect'); | 28 return browserTest.connectMe2Me() |
| 30 return browserTest.onUIMode(AppMode.CLIENT_PIN_PROMPT); | |
| 31 }).then( | 29 }).then( |
| 32 this.enterPin_.bind(this, data.pin) | 30 this.enterPin_.bind(this, data.pin) |
| 33 ).then(function() { | 31 ).then(function() { |
| 34 // On fulfilled. | 32 // On fulfilled. |
| 35 browserTest.pass(); | 33 browserTest.pass(); |
| 36 }, function(reason) { | 34 }, function(reason) { |
| 37 // On rejected. | 35 // On rejected. |
| 38 browserTest.fail(reason); | 36 browserTest.fail(reason); |
| 39 }); | 37 }); |
| 40 }; | 38 }; |
| 41 | 39 |
| 42 browserTest.Cancel_PIN.prototype.enterPin_ = function(pin) { | 40 browserTest.Cancel_PIN.prototype.enterPin_ = function(pin) { |
| 43 document.getElementById('pin-entry').value = pin; | 41 document.getElementById('pin-entry').value = pin; |
| 44 browserTest.clickOnControl('pin-connect-button'); | 42 browserTest.clickOnControl('pin-connect-button'); |
| 45 return browserTest.expectMe2MeConnected(); | 43 return browserTest.expectMe2MeConnected(); |
| 46 }; | 44 }; |
| OLD | NEW |