1 // Copyright 2015 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.
10 browserTest
.ConnectToLocalHost = function() {};
13 * @param {{pin:string}} data
15 browserTest
.ConnectToLocalHost
.prototype.run = function(data
) {
16 browserTest
.expect(typeof data
.pin
== 'string', 'The PIN must be a string');
17 browserTest
.connectMe2Me().then(function() {
18 return browserTest
.enterPIN(data
.pin
);
20 return browserTest
.disconnect();
23 }).catch(function(/** Error */ reason
) {
24 browserTest
.fail(reason
);
30 browserTest
.AliveOnLostFocus = function() {};
33 * @param {{pin:string}} data
35 browserTest
.AliveOnLostFocus
.prototype.run = function(data
) {
36 browserTest
.expect(typeof data
.pin
== 'string', 'The PIN must be a string');
37 browserTest
.connectMe2Me().then(function() {
38 return browserTest
.enterPIN(data
.pin
);
40 chrome
.app
.window
.current().minimize();
41 // Wait for a few seconds for app to process any notifications it
42 // would have got from minimizing.
43 return base
.Promise
.sleep(4000);
45 chrome
.app
.window
.current().restore();
47 // Validate that the session is still active.
48 if (remoting
.currentMode
!== remoting
.AppMode
.IN_SESSION
) {
50 'Unexpected session disconnect when the app is minimized.');
53 return browserTest
.disconnect();
56 }).catch(function(/** Error */ reason
) {
57 browserTest
.fail(reason
);