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. Hit cancel at the PIN prompt. | |
11 * 3. Reconnect with the PIN. | |
12 * 4. Verify that the session is connected. | |
13 */ | |
14 | |
15 'use strict'; | |
16 | |
17 /** @constructor */ | |
18 browserTest.Cancel_PIN = function(data) { | |
19 browserTest.assert(typeof data.pin == 'string'); | |
20 this.data_ = data; | |
21 this.bound_ = { | |
22 onPINPrompt: this.onPINPrompt_.bind(this), | |
23 onPINCancel: this.onPINCancel_.bind(this), | |
24 onPINPromptReconnect: this.onPINPromptReconnect_.bind(this), | |
25 onSessionConnected: this.onSessionConnected_.bind(this), | |
26 onSessionError: this.onSessionError_.bind(this) | |
Jamie
2014/05/09 01:02:18
I don't think there's a lot of value in pre-bindin
| |
27 }; | |
28 }; | |
29 | |
30 browserTest.Cancel_PIN.prototype.run = function() { | |
31 browserTest.waitForUIMode( | |
32 remoting.AppMode.CLIENT_PIN_PROMPT, | |
33 this.bound_.onPINPrompt); | |
34 | |
35 // Fail the test if there are any connection failures. | |
36 browserTest.waitForUIMode( | |
37 remoting.AppMode.CLIENT_CONNECT_FAILED_ME2ME, | |
38 this.bound_.onSessionError); | |
Jamie
2014/05/09 01:02:18
What's the default time-out for waitForUIMode? If
kelvinp
2014/05/12 21:08:34
Done.
| |
39 | |
40 this.clickOnMe2MeHost_(); | |
41 }; | |
42 | |
43 browserTest.Cancel_PIN.prototype.clickOnMe2MeHost_ = function() { | |
44 browserTest.clickOnControl('this-host-connect'); | |
45 }; | |
46 | |
47 browserTest.Cancel_PIN.prototype.onPINPrompt_ = function() { | |
48 browserTest.waitForUIMode( | |
49 remoting.AppMode.HOME, this.bound_.onPINCancel); | |
50 browserTest.clickOnControl('cancel-pin-entry-button'); | |
51 }; | |
52 | |
53 browserTest.Cancel_PIN.prototype.onPINCancel_ = function() { | |
54 browserTest.waitForUIMode( | |
55 remoting.AppMode.CLIENT_PIN_PROMPT, this.bound_.onPINPromptReconnect); | |
56 this.clickOnMe2MeHost_(); | |
57 }; | |
58 | |
59 browserTest.Cancel_PIN.prototype.onPINPromptReconnect_ = function() { | |
60 browserTest.waitForUIMode( | |
61 remoting.AppMode.IN_SESSION, this.bound_.onSessionConnected); | |
62 document.getElementById('pin-entry').value = this.data_.pin; | |
63 browserTest.clickOnControl('pin-connect-button'); | |
64 }; | |
65 | |
66 browserTest.Cancel_PIN.prototype.onSessionConnected_ = function() { | |
67 browserTest.pass(); | |
68 }; | |
69 | |
70 browserTest.Cancel_PIN.prototype.onSessionError_= function() { | |
71 var errorDiv = document.getElementById('connect-error-message'); | |
72 browserTest.fail(errorDiv.innerText); | |
73 }; | |
OLD | NEW |