| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 return browserTest.expectConnectionError( | 67 return browserTest.expectConnectionError( |
| 68 remoting.DesktopConnectedView.Mode.IT2ME, | 68 remoting.DesktopConnectedView.Mode.IT2ME, |
| 69 remoting.Error.INVALID_ACCESS_CODE); | 69 remoting.Error.Tag.INVALID_ACCESS_CODE); |
| 70 }).then(function() { | 70 }).then(function() { |
| 71 browserTest.pass(); | 71 browserTest.pass(); |
| 72 }, function(/** * */reason) { | 72 }, function(/** * */reason) { |
| 73 browserTest.fail(/** @type {Error} */(reason)); | 73 browserTest.fail(/** @type {Error} */(reason)); |
| 74 }); | 74 }); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 /** @constructor */ | 77 /** @constructor */ |
| 78 browserTest.GetAccessCode = function() {}; | 78 browserTest.GetAccessCode = function() {}; |
| 79 | 79 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 94 browserTest.expect(accessCode.length === 12, | 94 browserTest.expect(accessCode.length === 12, |
| 95 "The access code should be 12 digits long."); | 95 "The access code should be 12 digits long."); |
| 96 browserTest.expect( | 96 browserTest.expect( |
| 97 Number.isInteger(numericAccessCode) && numericAccessCode > 0, | 97 Number.isInteger(numericAccessCode) && numericAccessCode > 0, |
| 98 "The access code should be a positive integer."); | 98 "The access code should be a positive integer."); |
| 99 browserTest.pass(); | 99 browserTest.pass(); |
| 100 }, function(/** * */reason) { | 100 }, function(/** * */reason) { |
| 101 browserTest.fail(/** @type {Error} */(reason)); | 101 browserTest.fail(/** @type {Error} */(reason)); |
| 102 }); | 102 }); |
| 103 }; | 103 }; |
| OLD | NEW |