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 * Browser test for the scenario below: | 7 * Browser test for the scenario below: |
8 * 1. Generates an access code. | 8 * 1. Generates an access code. |
9 * 2. Launches another chromoting app instance. | 9 * 2. Launches another chromoting app instance. |
10 * 3. Connects with the generated access code. | 10 * 3. Connects with the generated access code. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 /** | 58 /** |
59 * @param {{pin: string, accessCode: string}} data | 59 * @param {{pin: string, accessCode: string}} data |
60 */ | 60 */ |
61 browserTest.InvalidAccessCode.prototype.run = function(data) { | 61 browserTest.InvalidAccessCode.prototype.run = function(data) { |
62 browserTest.expect(typeof data.accessCode == 'string', | 62 browserTest.expect(typeof data.accessCode == 'string', |
63 'The access code should be an non-empty string'); | 63 'The access code should be an non-empty string'); |
64 browserTest.ConnectIt2Me.clickOnAccessButton().then(function() { | 64 browserTest.ConnectIt2Me.clickOnAccessButton().then(function() { |
65 document.getElementById('access-code-entry').value = data.accessCode; | 65 document.getElementById('access-code-entry').value = data.accessCode; |
66 browserTest.clickOnControl('connect-button'); | 66 browserTest.clickOnControl('connect-button'); |
| 67 var ErrorTag = remoting.Error.Tag; |
67 return browserTest.expectConnectionError( | 68 return browserTest.expectConnectionError( |
68 remoting.DesktopConnectedView.Mode.IT2ME, | 69 remoting.DesktopConnectedView.Mode.IT2ME, |
69 remoting.Error.Tag.INVALID_ACCESS_CODE); | 70 [ErrorTag.INVALID_ACCESS_CODE, ErrorTag.HOST_IS_OFFLINE]); |
70 }).then(function() { | 71 }).then(function() { |
71 browserTest.pass(); | 72 browserTest.pass(); |
72 }, function(/** * */reason) { | 73 }, function(/** * */reason) { |
73 browserTest.fail(/** @type {Error} */(reason)); | 74 browserTest.fail(/** @type {Error} */(reason)); |
74 }); | 75 }); |
75 }; | 76 }; |
76 | 77 |
77 /** @constructor */ | 78 /** @constructor */ |
78 browserTest.GetAccessCode = function() {}; | 79 browserTest.GetAccessCode = function() {}; |
79 | 80 |
(...skipping 10 matching lines...) Expand all Loading... |
90 return browserTest.onUIMode(remoting.AppMode.HOST_WAITING_FOR_CONNECTION); | 91 return browserTest.onUIMode(remoting.AppMode.HOST_WAITING_FOR_CONNECTION); |
91 }).then(function() { | 92 }).then(function() { |
92 var accessCode = document.getElementById('access-code-display').innerText; | 93 var accessCode = document.getElementById('access-code-display').innerText; |
93 var numericAccessCode = parseFloat(accessCode); | 94 var numericAccessCode = parseFloat(accessCode); |
94 browserTest.expect(accessCode.length === 12, | 95 browserTest.expect(accessCode.length === 12, |
95 "The access code should be 12 digits long."); | 96 "The access code should be 12 digits long."); |
96 browserTest.expect( | 97 browserTest.expect( |
97 Number.isInteger(numericAccessCode) && numericAccessCode > 0, | 98 Number.isInteger(numericAccessCode) && numericAccessCode > 0, |
98 "The access code should be a positive integer."); | 99 "The access code should be a positive integer."); |
99 browserTest.pass(); | 100 browserTest.pass(); |
100 }, function(/** * */reason) { | 101 }).catch(function(/** Error */ reason) { |
101 browserTest.fail(/** @type {Error} */(reason)); | 102 browserTest.fail(reason); |
102 }); | 103 }); |
103 }; | 104 }; |
| 105 |
| 106 /** @constructor */ |
| 107 browserTest.CancelShare = function() {}; |
| 108 |
| 109 browserTest.CancelShare.prototype.run = function() { |
| 110 browserTest.clickOnControl('cancel-share-button'); |
| 111 browserTest.onUIMode(remoting.AppMode.HOST_SHARE_FINISHED).then(function() { |
| 112 browserTest.pass(); |
| 113 }).catch(function(/** Error */ reason) { |
| 114 browserTest.fail(reason); |
| 115 }); |
| 116 }; |
OLD | NEW |