| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * TestFixture for EditDictionaryOverlay WebUI testing. |
| 7 * @extends {testing.Test} |
| 8 * @constructor |
| 9 **/ |
| 10 function EditDictionaryWebUITest() {} |
| 11 |
| 12 EditDictionaryWebUITest.prototype = { |
| 13 __proto__: testing.Test.prototype, |
| 14 |
| 15 /** |
| 16 * Browse to the edit dictionary page & call our preLoad(). |
| 17 */ |
| 18 browsePreload: 'chrome://settings-frame/editDictionary', |
| 19 |
| 20 /** |
| 21 * Register a mock dictionary handler. |
| 22 */ |
| 23 preLoad: function() { |
| 24 this.makeAndRegisterMockHandler( |
| 25 ['refreshDictionaryWords', |
| 26 'addDictionaryWord', |
| 27 'removeDictionaryWord', |
| 28 ]); |
| 29 this.mockHandler.stubs().refreshDictionaryWords(). |
| 30 will(callFunction(function() { |
| 31 EditDictionaryOverlay.setWordList([]); |
| 32 })); |
| 33 this.mockHandler.stubs().addDictionaryWord(ANYTHING); |
| 34 this.mockHandler.stubs().removeDictionaryWord(ANYTHING); |
| 35 }, |
| 36 }; |
| 37 |
| 38 TEST_F('EditDictionaryWebUITest', 'testAddRemoveWords', function() { |
| 39 var testWord = 'foo'; |
| 40 $('language-dictionary-overlay-page').querySelector('input').value = testWord; |
| 41 |
| 42 this.mockHandler.expects(once()).addDictionaryWord([testWord]). |
| 43 will(callFunction(function() { |
| 44 EditDictionaryOverlay.setWordList([testWord]); |
| 45 })); |
| 46 EditDictionaryOverlay.getInstance().wordList_.items[0].onEditCommitted_(null); |
| 47 |
| 48 this.mockHandler.expects(once()).removeDictionaryWord([String(0)]). |
| 49 will(callFunction(function() { |
| 50 EditDictionaryOverlay.setWordList([]); |
| 51 })); |
| 52 EditDictionaryOverlay.getInstance().wordList_.deleteItemAtIndex(0); |
| 53 }); |
| OLD | NEW |