OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 /** |
| 6 * @fileoverview |
| 7 * @suppress {checkTypes} |
| 8 * Browser test for the scenario below: |
| 9 * 1. Attempt to connect. |
| 10 * 2. Enter |data.pin| at the PIN prompt. |
| 11 * 3. Verify that there is connection error due to invalid access code. |
| 12 */ |
| 13 |
| 14 'use strict'; |
| 15 |
| 16 /** @constructor */ |
| 17 browserTest.Invalid_PIN = function() {}; |
| 18 |
| 19 browserTest.Invalid_PIN.prototype.run = function(data) { |
| 20 // Input validation. |
| 21 browserTest.expect(typeof data.pin == 'string'); |
| 22 |
| 23 // Connect to me2me Host. |
| 24 browserTest.clickOnControl('this-host-connect'); |
| 25 |
| 26 browserTest.onUIMode(remoting.AppMode.CLIENT_PIN_PROMPT).then( |
| 27 this.enterPIN_.bind(this, data.pin) |
| 28 ).then( |
| 29 // Sleep for two seconds to allow the host backoff timer to reset. |
| 30 base.Promise.sleep.bind(window, 2000) |
| 31 ).then(function() { |
| 32 // On fulfilled. |
| 33 browserTest.pass(); |
| 34 }, function(reason) { |
| 35 // On rejected. |
| 36 browserTest.fail(reason); |
| 37 }); |
| 38 }; |
| 39 |
| 40 browserTest.Invalid_PIN.prototype.enterPIN_ = function(pin) { |
| 41 document.getElementById('pin-entry').value = pin; |
| 42 browserTest.clickOnControl('pin-connect-button'); |
| 43 return browserTest.expectMe2MeError(remoting.Error.INVALID_ACCESS_CODE); |
| 44 }; |
OLD | NEW |