| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 The Chromium Authors. All rights reserved. | 2 * Copyright 2013 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Set to true while debugging virtual keyboard tests, for verbose debug output. | 8 * Set to true while debugging virtual keyboard tests, for verbose debug output. |
| 9 */ | 9 */ |
| 10 var debugging = false; | 10 var debugging = false; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 * Adds mocks for chrome extension API calls. | 47 * Adds mocks for chrome extension API calls. |
| 48 * | 48 * |
| 49 * @param {MockController} mockController Controller for validating | 49 * @param {MockController} mockController Controller for validating |
| 50 * calls with expectations. | 50 * calls with expectations. |
| 51 */ | 51 */ |
| 52 function mockExtensionApis(mockController) { | 52 function mockExtensionApis(mockController) { |
| 53 | 53 |
| 54 /** | 54 /** |
| 55 * Mocks methods within a namespace. | 55 * Mocks methods within a namespace. |
| 56 * @param {string} namespace Dot delimited namespace. | 56 * @param {string} namespace Dot delimited namespace. |
| 57 * @param {Array.<string>} methods List of methods names to mock. | 57 * @param {Array<string>} methods List of methods names to mock. |
| 58 */ | 58 */ |
| 59 var addMocks = function(namespace, methods) { | 59 var addMocks = function(namespace, methods) { |
| 60 var parts = namespace.split('.'); | 60 var parts = namespace.split('.'); |
| 61 var base = window; | 61 var base = window; |
| 62 for (var i = 0; i < parts.length; i++) { | 62 for (var i = 0; i < parts.length; i++) { |
| 63 if (!base[parts[i]]) | 63 if (!base[parts[i]]) |
| 64 base[parts[i]] = {}; | 64 base[parts[i]] = {}; |
| 65 base = base[parts[i]]; | 65 base = base[parts[i]]; |
| 66 } | 66 } |
| 67 methods.forEach(function(m) { | 67 methods.forEach(function(m) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 }; | 235 }; |
| 236 window.initializeVirtualKeyboard(config.keyset, | 236 window.initializeVirtualKeyboard(config.keyset, |
| 237 config.languageCode, | 237 config.languageCode, |
| 238 config.passwordLayout, | 238 config.passwordLayout, |
| 239 config.name, | 239 config.name, |
| 240 options); | 240 options); |
| 241 } | 241 } |
| 242 | 242 |
| 243 /** | 243 /** |
| 244 * Defers continuation of a test until one or more keysets are loaded. | 244 * Defers continuation of a test until one or more keysets are loaded. |
| 245 * @param {string|Array.<string>} keyset Name of the target keyset or list of | 245 * @param {string|Array<string>} keyset Name of the target keyset or list of |
| 246 * keysets. | 246 * keysets. |
| 247 * @param {Function} continueTestCallback Callback function to invoke in order | 247 * @param {Function} continueTestCallback Callback function to invoke in order |
| 248 * to resume the test. | 248 * to resume the test. |
| 249 */ | 249 */ |
| 250 function onKeysetsReady(keyset, continueTestCallback) { | 250 function onKeysetsReady(keyset, continueTestCallback) { |
| 251 if (keyset instanceof Array) { | 251 if (keyset instanceof Array) { |
| 252 var blocked = false; | 252 var blocked = false; |
| 253 keyset.forEach(function(id) { | 253 keyset.forEach(function(id) { |
| 254 if (!(id in controller.container_.keysetViewMap)) | 254 if (!(id in controller.container_.keysetViewMap)) |
| 255 blocked = true; | 255 blocked = true; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 assertTrue(!!switchKey, 'Unable to find symbol transition key'); | 430 assertTrue(!!switchKey, 'Unable to find symbol transition key'); |
| 431 // Switch to symbol keyset. | 431 // Switch to symbol keyset. |
| 432 mockTap(switchKey); | 432 mockTap(switchKey); |
| 433 } else { | 433 } else { |
| 434 var switchKey = findKey('~[<', 'row3'); | 434 var switchKey = findKey('~[<', 'row3'); |
| 435 assertTrue(!!switchKey, 'Unable to find more transition key'); | 435 assertTrue(!!switchKey, 'Unable to find more transition key'); |
| 436 // Switch to more keyset. | 436 // Switch to more keyset. |
| 437 mockTap(switchKey); | 437 mockTap(switchKey); |
| 438 } | 438 } |
| 439 } | 439 } |
| OLD | NEW |