summaryrefslogtreecommitdiffstats
path: root/remoting/webapp/browser_test/invalid_pin_browser_test.js
blob: 1d08d1ab5ac56ecfe5f6de382842cdde569473ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @fileoverview
 * @suppress {checkTypes}
 * Browser test for the scenario below:
 * 1. Attempt to connect.
 * 2. Enter |data.pin| at the PIN prompt.
 * 3. Verify that there is connection error due to invalid access code.
 */

'use strict';

/** @constructor */
browserTest.Invalid_PIN = function() {};

/**
 * @param {{pin:string}} data
 */
browserTest.Invalid_PIN.prototype.run = function(data) {
  // Input validation.
  browserTest.expect(typeof data.pin == 'string');

  // Connect to me2me Host.
  browserTest.connectMe2Me().then(function(){
    return browserTest.enterPIN(data.pin, true)
  }).then(
    // Sleep for two seconds to allow the host backoff timer to reset.
    base.Promise.sleep.bind(window, 2000)
  ).then(function() {
    // On fulfilled.
    browserTest.pass();
  }, function(reason) {
    // On rejected.
    browserTest.fail(reason);
  });
};