| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 expectEquals(2, EditDictionaryOverlay.getWordListForTesting().items.length); | 130 expectEquals(2, EditDictionaryOverlay.getWordListForTesting().items.length); |
| 131 | 131 |
| 132 // Backend notifies UI that the words 'bar' and 'baz' were added. UI shows | 132 // Backend notifies UI that the words 'bar' and 'baz' were added. UI shows |
| 133 // these new words. | 133 // these new words. |
| 134 EditDictionaryOverlay.updateWords(['bar', 'baz'], []); | 134 EditDictionaryOverlay.updateWords(['bar', 'baz'], []); |
| 135 expectEquals(4, EditDictionaryOverlay.getWordListForTesting().items.length); | 135 expectEquals(4, EditDictionaryOverlay.getWordListForTesting().items.length); |
| 136 }); | 136 }); |
| 137 | 137 |
| 138 // Verify that dictionary hides newly removed words that arrived in a | 138 // Verify that dictionary hides newly removed words that arrived in a |
| 139 // notification, but ignores duplicate remove notifications. | 139 // notification, but ignores duplicate remove notifications. |
| 140 TEST_F('EditDictionaryWebUITest', 'testRemoveNotification', function() { | 140 // TODO(crbug.com/631940): Flaky on Win 7. |
| 141 GEN('#if defined(OS_WIN)'); |
| 142 GEN('#define MAYBE_testRemoveNotification DISABLED_testRemoveNotification'); |
| 143 GEN('#else'); |
| 144 GEN('#define MAYBE_testRemoveNotification testRemoveNotification'); |
| 145 GEN('#endif // defined(OS_WIN)'); |
| 146 TEST_F('EditDictionaryWebUITest', 'MAYBE_testRemoveNotification', function() { |
| 141 // Begin with a dictionary with words 'foo', 'bar', 'baz', and 'baz'. The | 147 // Begin with a dictionary with words 'foo', 'bar', 'baz', and 'baz'. The |
| 142 // second instance of 'baz' appears because the user added the word twice. | 148 // second instance of 'baz' appears because the user added the word twice. |
| 143 // The backend keeps only one copy of the word. | 149 // The backend keeps only one copy of the word. |
| 144 EditDictionaryOverlay.setWordList(['foo', 'bar', 'baz', 'baz']); | 150 EditDictionaryOverlay.setWordList(['foo', 'bar', 'baz', 'baz']); |
| 145 expectEquals(5, EditDictionaryOverlay.getWordListForTesting().items.length); | 151 expectEquals(5, EditDictionaryOverlay.getWordListForTesting().items.length); |
| 146 | 152 |
| 147 // User deletes the second instance of 'baz'. | 153 // User deletes the second instance of 'baz'. |
| 148 EditDictionaryOverlay.getWordListForTesting().deleteItemAtIndex(3); | 154 EditDictionaryOverlay.getWordListForTesting().deleteItemAtIndex(3); |
| 149 expectEquals(4, EditDictionaryOverlay.getWordListForTesting().items.length); | 155 expectEquals(4, EditDictionaryOverlay.getWordListForTesting().items.length); |
| 150 | 156 |
| 151 // Backend notifies UI that the word 'baz' has been removed. UI ignores this | 157 // Backend notifies UI that the word 'baz' has been removed. UI ignores this |
| 152 // notification. | 158 // notification. |
| 153 EditDictionaryOverlay.updateWords([], ['baz']); | 159 EditDictionaryOverlay.updateWords([], ['baz']); |
| 154 expectEquals(4, EditDictionaryOverlay.getWordListForTesting().items.length); | 160 expectEquals(4, EditDictionaryOverlay.getWordListForTesting().items.length); |
| 155 | 161 |
| 156 // Backend notifies UI that words 'foo' and 'bar' have been removed. UI | 162 // Backend notifies UI that words 'foo' and 'bar' have been removed. UI |
| 157 // removes these words. | 163 // removes these words. |
| 158 EditDictionaryOverlay.updateWords([], ['foo', 'bar']); | 164 EditDictionaryOverlay.updateWords([], ['foo', 'bar']); |
| 159 expectEquals(2, EditDictionaryOverlay.getWordListForTesting().items.length); | 165 expectEquals(2, EditDictionaryOverlay.getWordListForTesting().items.length); |
| 160 }); | 166 }); |
| OLD | NEW |