| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 GEN_INCLUDE(['options_browsertest_base.js']); | 5 GEN_INCLUDE(['options_browsertest_base.js']); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * TestFixture for EditDictionaryOverlay WebUI testing. | 8 * TestFixture for EditDictionaryOverlay WebUI testing. |
| 9 * @extends {testing.Test} | 9 * @extends {testing.Test} |
| 10 * @constructor | 10 * @constructor |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 expectEquals(3, EditDictionaryOverlay.getWordListForTesting().items.length); | 100 expectEquals(3, EditDictionaryOverlay.getWordListForTesting().items.length); |
| 101 }); | 101 }); |
| 102 | 102 |
| 103 TEST_F('EditDictionaryWebUITest', 'testNoCloseOnSearchEnter', function() { | 103 TEST_F('EditDictionaryWebUITest', 'testNoCloseOnSearchEnter', function() { |
| 104 var editDictionaryPage = EditDictionaryOverlay.getInstance(); | 104 var editDictionaryPage = EditDictionaryOverlay.getInstance(); |
| 105 assertTrue(editDictionaryPage.visible); | 105 assertTrue(editDictionaryPage.visible); |
| 106 var searchField = $('language-dictionary-overlay-search-field'); | 106 var searchField = $('language-dictionary-overlay-search-field'); |
| 107 searchField.dispatchEvent(new KeyboardEvent('keydown', { | 107 searchField.dispatchEvent(new KeyboardEvent('keydown', { |
| 108 'bubbles': true, | 108 'bubbles': true, |
| 109 'cancelable': true, | 109 'cancelable': true, |
| 110 'keyIdentifier': 'Enter' | 110 'key': 'Enter' |
| 111 })); | 111 })); |
| 112 assertTrue(editDictionaryPage.visible); | 112 assertTrue(editDictionaryPage.visible); |
| 113 }); | 113 }); |
| 114 | 114 |
| 115 // Verify that dictionary shows newly added words that arrived in a | 115 // Verify that dictionary shows newly added words that arrived in a |
| 116 // notification, but ignores duplicate add notifications. | 116 // notification, but ignores duplicate add notifications. |
| 117 TEST_F('EditDictionaryWebUITest', 'testAddNotification', function() { | 117 TEST_F('EditDictionaryWebUITest', 'testAddNotification', function() { |
| 118 // Begin with an empty dictionary. | 118 // Begin with an empty dictionary. |
| 119 EditDictionaryOverlay.setWordList([]); | 119 EditDictionaryOverlay.setWordList([]); |
| 120 expectEquals(1, EditDictionaryOverlay.getWordListForTesting().items.length); | 120 expectEquals(1, EditDictionaryOverlay.getWordListForTesting().items.length); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 151 // Backend notifies UI that the word 'baz' has been removed. UI ignores this | 151 // Backend notifies UI that the word 'baz' has been removed. UI ignores this |
| 152 // notification. | 152 // notification. |
| 153 EditDictionaryOverlay.updateWords([], ['baz']); | 153 EditDictionaryOverlay.updateWords([], ['baz']); |
| 154 expectEquals(4, EditDictionaryOverlay.getWordListForTesting().items.length); | 154 expectEquals(4, EditDictionaryOverlay.getWordListForTesting().items.length); |
| 155 | 155 |
| 156 // Backend notifies UI that words 'foo' and 'bar' have been removed. UI | 156 // Backend notifies UI that words 'foo' and 'bar' have been removed. UI |
| 157 // removes these words. | 157 // removes these words. |
| 158 EditDictionaryOverlay.updateWords([], ['foo', 'bar']); | 158 EditDictionaryOverlay.updateWords([], ['foo', 'bar']); |
| 159 expectEquals(2, EditDictionaryOverlay.getWordListForTesting().items.length); | 159 expectEquals(2, EditDictionaryOverlay.getWordListForTesting().items.length); |
| 160 }); | 160 }); |
| OLD | NEW |