Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: remoting/webapp/browser_test/it2me_browser_test.js

Issue 927373005: [Chromoting] Enable jscompile for browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittests; More review comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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. Generates an access code. 9 * 1. Generates an access code.
10 * 2. Launches another chromoting app instance. 10 * 2. Launches another chromoting app instance.
11 * 3. Connects with the generated access code. 11 * 3. Connects with the generated access code.
12 * 4. Verifies that the session is connected. 12 * 4. Verifies that the session is connected.
13 */ 13 */
14 14
15 'use strict'; 15 'use strict';
16 16
17 /** @constructor */ 17 /** @constructor */
18 browserTest.ConnectIt2Me = function() {}; 18 browserTest.ConnectIt2Me = function() {};
19 19
20 /**
21 * @param {{pin: string, accessCode: string}} data
22 */
20 browserTest.ConnectIt2Me.prototype.run = function(data) { 23 browserTest.ConnectIt2Me.prototype.run = function(data) {
21 browserTest.expect(typeof data.accessCode == 'string', 24 browserTest.expect(typeof data.accessCode == 'string',
22 'The access code should be an non-empty string'); 25 'The access code should be an non-empty string');
23 browserTest.clickOnControl('get-started-it2me'); 26 browserTest.clickOnControl('get-started-it2me');
24 var that = this; 27 var that = this;
25 browserTest.ConnectIt2Me.clickOnAccessButton().then(function() { 28 browserTest.ConnectIt2Me.clickOnAccessButton().then(function() {
26 return that.enterAccessCode_(data.accessCode); 29 return that.enterAccessCode_(data.accessCode);
27 }).then(function() { 30 }).then(function() {
28 return browserTest.disconnect(); 31 return browserTest.disconnect();
29 }).then(function() { 32 }).then(function() {
30 browserTest.pass(); 33 browserTest.pass();
34 /** @param {*} reason */
31 }, function(reason) { 35 }, function(reason) {
32 browserTest.fail(reason); 36 browserTest.fail(reason);
33 }); 37 });
34 }; 38 };
35 39
40 /** @return {Promise} */
36 browserTest.ConnectIt2Me.clickOnAccessButton = function() { 41 browserTest.ConnectIt2Me.clickOnAccessButton = function() {
37 browserTest.clickOnControl('access-mode-button'); 42 browserTest.clickOnControl('access-mode-button');
38 return browserTest.onUIMode(remoting.AppMode.CLIENT_UNCONNECTED); 43 return browserTest.onUIMode(remoting.AppMode.CLIENT_UNCONNECTED);
39 }; 44 };
40 45
41 /** @private */ 46 /**
47 * @param {string} code
48 * @return {Promise}
49 * @private
50 */
42 browserTest.ConnectIt2Me.prototype.enterAccessCode_ = function(code) { 51 browserTest.ConnectIt2Me.prototype.enterAccessCode_ = function(code) {
43 document.getElementById('access-code-entry').value = code; 52 document.getElementById('access-code-entry').value = code;
44 browserTest.clickOnControl('connect-button'); 53 browserTest.clickOnControl('connect-button');
45 return browserTest.expectConnected(); 54 return browserTest.expectConnected();
46 }; 55 };
47 56
48 /** @constructor */ 57 /** @constructor */
49 browserTest.InvalidAccessCode = function() {}; 58 browserTest.InvalidAccessCode = function() {};
50 59
60 /**
61 * @param {{pin: string, accessCode: string}} data
62 */
51 browserTest.InvalidAccessCode.prototype.run = function(data) { 63 browserTest.InvalidAccessCode.prototype.run = function(data) {
52 browserTest.expect(typeof data.accessCode == 'string', 64 browserTest.expect(typeof data.accessCode == 'string',
53 'The access code should be an non-empty string'); 65 'The access code should be an non-empty string');
54 browserTest.ConnectIt2Me.clickOnAccessButton().then(function() { 66 browserTest.ConnectIt2Me.clickOnAccessButton().then(function() {
55 document.getElementById('access-code-entry').value = data.accessCode; 67 document.getElementById('access-code-entry').value = data.accessCode;
56 browserTest.clickOnControl('connect-button'); 68 browserTest.clickOnControl('connect-button');
57 return browserTest.expectConnectionError( 69 return browserTest.expectConnectionError(
58 remoting.ClientSession.Mode.IT2ME, remoting.Error.INVALID_ACCESS_CODE); 70 remoting.DesktopConnectedView.Mode.IT2ME,
71 remoting.Error.INVALID_ACCESS_CODE);
59 }).then(function() { 72 }).then(function() {
60 browserTest.pass(); 73 browserTest.pass();
61 }, function(reason) { 74 }, function(reason) {
62 browserTest.fail(reason); 75 browserTest.fail(reason);
63 }); 76 });
64 }; 77 };
65 78
66 /** @constructor */ 79 /** @constructor */
67 browserTest.GetAccessCode = function() {}; 80 browserTest.GetAccessCode = function() {};
68 81
(...skipping 10 matching lines...) Expand all
79 "The access code should be 12 digits long."); 92 "The access code should be 12 digits long.");
80 browserTest.expect( 93 browserTest.expect(
81 Number.isInteger(numericAccessCode) && numericAccessCode > 0, 94 Number.isInteger(numericAccessCode) && numericAccessCode > 0,
82 "The access code should be a positive integer."); 95 "The access code should be a positive integer.");
83 browserTest.pass(accessCode); 96 browserTest.pass(accessCode);
84 },function(reason) { 97 },function(reason) {
85 browserTest.fail(reason); 98 browserTest.fail(reason);
86 }); 99 });
87 }; 100 };
88 101
89 // Wait for the email address of the local user to become available. The email 102 /**
90 // address is required in an It2Me connection for domain policy enforcement. 103 * Wait for the email address of the local user to become available. The email
91 // TODO:(kelvinp) Fix this awkward behavior in the production code so that this 104 * address is required in an It2Me connection for domain policy enforcement.
92 // hack is no longer required. 105 * TODO:(kelvinp) Fix this awkward behavior in the production code so that this
93 /** @private */ 106 * hack is no longer required.
107 *
108 * @return {Promise}
109 * @private
110 */
94 browserTest.GetAccessCode.prototype.onUserInfoReady_ = function() { 111 browserTest.GetAccessCode.prototype.onUserInfoReady_ = function() {
95 return new Promise(function(resolve, reject){ 112 return new Promise(function(resolve, reject){
96 remoting.identity.getUserInfo(resolve, reject); 113 remoting.identity.getUserInfo(resolve, reject);
97 }); 114 });
98 }; 115 };
OLDNEW
« no previous file with comments | « remoting/webapp/browser_test/invalid_pin_browser_test.js ('k') | remoting/webapp/browser_test/mock_client_plugin.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698