| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 * TestFixture for kiosk app settings WebUI testing. | 6 * TestFixture for kiosk app settings WebUI testing. |
| 7 * @extends {testing.Test} | 7 * @extends {testing.Test} |
| 8 * @constructor | 8 * @constructor |
| 9 */ | 9 */ |
| 10 function KioskAppSettingsWebUITest() {} | 10 function KioskAppSettingsWebUITest() {} |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 }); | 83 }); |
| 84 | 84 |
| 85 // Verify that enter key on 'kiosk-app-id-edit' adds an app. | 85 // Verify that enter key on 'kiosk-app-id-edit' adds an app. |
| 86 TEST_F('KioskAppSettingsWebUITest', 'testAddKioskApp', function() { | 86 TEST_F('KioskAppSettingsWebUITest', 'testAddKioskApp', function() { |
| 87 var testAppId = 'app_3'; | 87 var testAppId = 'app_3'; |
| 88 var appIdInput = $('kiosk-app-id-edit'); | 88 var appIdInput = $('kiosk-app-id-edit'); |
| 89 | 89 |
| 90 appIdInput.value = testAppId; | 90 appIdInput.value = testAppId; |
| 91 | 91 |
| 92 this.mockHandler.expects(once()).addKioskApp([testAppId]); | 92 this.mockHandler.expects(once()).addKioskApp([testAppId]); |
| 93 var keypress = document.createEvent('KeyboardEvents'); | 93 var keypress = new KeyboardEvent('keypress', {cancelable: true, bubbles: true,
key: 'Enter'}); |
| 94 keypress.initKeyboardEvent('keypress', true, true, null, 'Enter', ''); | |
| 95 appIdInput.dispatchEvent(keypress); | 94 appIdInput.dispatchEvent(keypress); |
| 96 }); | 95 }); |
| 97 | 96 |
| 98 // Verify that the 'kiosk-app-add' button adds an app. | 97 // Verify that the 'kiosk-app-add' button adds an app. |
| 99 TEST_F('KioskAppSettingsWebUITest', 'testAddKioskAppByAddButton', function() { | 98 TEST_F('KioskAppSettingsWebUITest', 'testAddKioskAppByAddButton', function() { |
| 100 var testAppId = 'app_3'; | 99 var testAppId = 'app_3'; |
| 101 $('kiosk-app-id-edit').value = testAppId; | 100 $('kiosk-app-id-edit').value = testAppId; |
| 102 | 101 |
| 103 this.mockHandler.expects(once()).addKioskApp([testAppId]); | 102 this.mockHandler.expects(once()).addKioskApp([testAppId]); |
| 104 cr.dispatchSimpleEvent($('kiosk-app-add'), 'click'); | 103 cr.dispatchSimpleEvent($('kiosk-app-add'), 'click'); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 var checkbox = $('kiosk-disable-bailout-shortcut'); | 226 var checkbox = $('kiosk-disable-bailout-shortcut'); |
| 228 | 227 |
| 229 this.settings_.hasAutoLaunchApp = false; | 228 this.settings_.hasAutoLaunchApp = false; |
| 230 extensions.KioskAppsOverlay.setSettings(this.settings_); | 229 extensions.KioskAppsOverlay.setSettings(this.settings_); |
| 231 expectTrue(checkbox.disabled); | 230 expectTrue(checkbox.disabled); |
| 232 | 231 |
| 233 this.settings_.hasAutoLaunchApp = true; | 232 this.settings_.hasAutoLaunchApp = true; |
| 234 extensions.KioskAppsOverlay.setSettings(this.settings_); | 233 extensions.KioskAppsOverlay.setSettings(this.settings_); |
| 235 expectFalse(checkbox.disabled); | 234 expectFalse(checkbox.disabled); |
| 236 }); | 235 }); |
| OLD | NEW |