| 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. Enter |data.pin| at the PIN prompt. | 10 * 2. Enter |data.pin| at the PIN prompt. |
| 11 * 3. Verify that there is connection error due to invalid access code. | 11 * 3. Verify that there is connection error due to invalid access code. |
| 12 */ | 12 */ |
| 13 | 13 |
| 14 'use strict'; | 14 'use strict'; |
| 15 | 15 |
| 16 /** @constructor */ | 16 /** @constructor */ |
| 17 browserTest.Invalid_PIN = function() {}; | 17 browserTest.Invalid_PIN = function() {}; |
| 18 | 18 |
| 19 /** |
| 20 * @param {{pin: string, accessCode: string}} data |
| 21 */ |
| 19 browserTest.Invalid_PIN.prototype.run = function(data) { | 22 browserTest.Invalid_PIN.prototype.run = function(data) { |
| 20 // Input validation. | 23 // Input validation. |
| 21 browserTest.expect(typeof data.pin == 'string'); | 24 browserTest.expect(typeof data.pin == 'string'); |
| 22 | 25 |
| 23 // Connect to me2me Host. | 26 // Connect to me2me Host. |
| 24 browserTest.connectMe2Me().then(function(){ | 27 browserTest.connectMe2Me().then(function(){ |
| 25 return browserTest.enterPIN(data.pin, true) | 28 return browserTest.enterPIN(data.pin, true) |
| 26 }).then( | 29 }).then( |
| 27 // Sleep for two seconds to allow the host backoff timer to reset. | 30 // Sleep for two seconds to allow the host backoff timer to reset. |
| 28 base.Promise.sleep.bind(window, 2000) | 31 base.Promise.sleep.bind(window, 2000) |
| 29 ).then(function() { | 32 ).then(function() { |
| 30 // On fulfilled. | 33 // On fulfilled. |
| 31 browserTest.pass(); | 34 browserTest.pass(); |
| 32 }, function(reason) { | 35 }, function(reason) { |
| 33 // On rejected. | 36 // On rejected. |
| 34 browserTest.fail(reason); | 37 browserTest.fail(reason); |
| 35 }); | 38 }); |
| 36 }; | 39 }; |
| OLD | NEW |