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
4 * found in the LICENSE file.
8 * Asynchronously tests that invert propagates correctly. This catches the
9 * regression crbug.com/3277551.
10 * @param {function} testDoneCallBack The callback function to be called
13 function testInvertAttributeAsync(testDoneCallback) {
14 var tester = new SubtaskScheduler();
15 tester.init = function() {
16 $('keyboard').layout = Layout.SYSTEM;
19 var onSystemQwertyLower = function() {
20 assertEquals(Keyset.SYSTEM_LOWER, $('keyboard').activeKeysetId,
22 var key = findKey('[');
23 assertFalse(key.invert, "Unexpected inverted key in lower keyset.");
24 $('keyboard').keyset = Keyset.UPPER;
27 tester.addWaitCondition(onSystemQwertyLower, Keyset.SYSTEM_LOWER);
28 tester.addSubtask(onSystemQwertyLower);
30 var onSystemQwertyUpper = function() {
31 assertEquals(Keyset.SYSTEM_UPPER, $('keyboard').activeKeysetId,
33 var key = findKey('{');
34 assertTrue(key.invert, "Key not inverted in upper keyset.");
35 $('keyboard').layout = Layout.DEFAULT;
38 tester.addWaitCondition(onSystemQwertyUpper, Keyset.SYSTEM_UPPER);
39 tester.addSubtask(onSystemQwertyUpper);
41 var onReset = function() {
42 assertEquals(Keyset.DEFAULT_LOWER, $('keyboard').activeKeysetId,
45 tester.addWaitCondition(onReset, Keyset.DEFAULT_LOWER);
46 tester.addSubtask(onReset);
48 tester.scheduleTest('testInvertAttributeAsync', testDoneCallback);