Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4879)

Unified Diff: chrome/browser/ui/webui/options/edit_dictionary_browsertest.js

Issue 11308076: Browser-tests for editing the dictionary on chrome://settings/editDictionary (Closed) Base URL: http://git.chromium.org/chromium/src.git@dictionary
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/options/language_dictionary_overlay.js ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/edit_dictionary_browsertest.js
diff --git a/chrome/browser/ui/webui/options/edit_dictionary_browsertest.js b/chrome/browser/ui/webui/options/edit_dictionary_browsertest.js
new file mode 100644
index 0000000000000000000000000000000000000000..61d183a70a874632f3df9e75112c50e84eece68e
--- /dev/null
+++ b/chrome/browser/ui/webui/options/edit_dictionary_browsertest.js
@@ -0,0 +1,53 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * TestFixture for EditDictionaryOverlay WebUI testing.
+ * @extends {testing.Test}
+ * @constructor
+ **/
+function EditDictionaryWebUITest() {}
+
+EditDictionaryWebUITest.prototype = {
+ __proto__: testing.Test.prototype,
+
+ /**
+ * Browse to the edit dictionary page & call our preLoad().
+ */
+ browsePreload: 'chrome://settings-frame/editDictionary',
+
+ /**
+ * Register a mock dictionary handler.
+ */
+ preLoad: function() {
+ this.makeAndRegisterMockHandler(
+ ['refreshDictionaryWords',
+ 'addDictionaryWord',
+ 'removeDictionaryWord',
+ ]);
+ this.mockHandler.stubs().refreshDictionaryWords().
+ will(callFunction(function() {
+ EditDictionaryOverlay.setWordList([]);
+ }));
+ this.mockHandler.stubs().addDictionaryWord(ANYTHING);
+ this.mockHandler.stubs().removeDictionaryWord(ANYTHING);
+ },
+};
+
+TEST_F('EditDictionaryWebUITest', 'testAddRemoveWords', function() {
+ var testWord = 'foo';
+ $('language-dictionary-overlay-page').querySelector('input').value = testWord;
+
+ this.mockHandler.expects(once()).addDictionaryWord([testWord]).
+ will(callFunction(function() {
+ EditDictionaryOverlay.setWordList([testWord]);
+ }));
+ EditDictionaryOverlay.getInstance().wordList_.items[0].onEditCommitted_(null);
+
+ this.mockHandler.expects(once()).removeDictionaryWord([String(0)]).
+ will(callFunction(function() {
+ EditDictionaryOverlay.setWordList([]);
+ }));
+ EditDictionaryOverlay.getInstance().wordList_.deleteItemAtIndex(0);
+});
« no previous file with comments | « chrome/browser/resources/options/language_dictionary_overlay.js ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698