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

Unified Diff: chrome/browser/spellcheck_unittest.cc

Issue 342068: Third patch in getting rid of caching MessageLoop pointers and always using C... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months 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/safe_browsing/safe_browsing_service.cc ('k') | chrome/browser/spellchecker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/spellcheck_unittest.cc
===================================================================
--- chrome/browser/spellcheck_unittest.cc (revision 30650)
+++ chrome/browser/spellcheck_unittest.cc (working copy)
@@ -8,6 +8,7 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/sys_string_conversions.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/spellchecker.h"
#include "chrome/browser/spellchecker_platform_engine.h"
#include "chrome/common/chrome_paths.h"
@@ -19,8 +20,17 @@
} // namespace
class SpellCheckTest : public testing::Test {
+ public:
+ SpellCheckTest()
+ : file_thread_(ChromeThread::FILE, &message_loop_),
+ io_thread_(ChromeThread::IO, &message_loop_) {}
+
+ protected:
+ MessageLoop message_loop_;
+
private:
- MessageLoop message_loop_;
+ ChromeThread file_thread_;
+ ChromeThread io_thread_; // To keep DCHECKs inside spell checker happy.
};
// Represents a special initialization function used only for the unit tests
@@ -271,6 +281,8 @@
scoped_refptr<SpellChecker> spell_checker(new SpellChecker(
hunspell_directory, "en-US", NULL, FilePath()));
+ spell_checker->Initialize();
+ message_loop_.RunAllPending();
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
size_t input_length = 0;
@@ -616,6 +628,8 @@
scoped_refptr<SpellChecker> spell_checker(new SpellChecker(
hunspell_directory, "en-US", NULL, FilePath()));
+ spell_checker->Initialize();
+ message_loop_.RunAllPending();
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
std::vector<string16> suggestions;
@@ -889,6 +903,8 @@
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
scoped_refptr<SpellChecker> spell_checker(new SpellChecker(
hunspell_directory, kTestCases[i].language, NULL, FilePath()));
+ spell_checker->Initialize();
+ message_loop_.RunAllPending();
size_t input_length = 0;
if (kTestCases[i].input != NULL)
@@ -926,6 +942,8 @@
scoped_refptr<SpellChecker> spell_checker(new SpellChecker(
hunspell_directory, "en-US", NULL, custom_dictionary_file));
+ spell_checker->Initialize();
+ message_loop_.RunAllPending();
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
// Add the word to spellchecker.
@@ -954,6 +972,8 @@
// Now initialize another spellchecker to see that AddToWord is permanent.
scoped_refptr<SpellChecker> spell_checker_new(new SpellChecker(
hunspell_directory, "en-US", NULL, custom_dictionary_file));
+ spell_checker->Initialize();
+ message_loop_.RunAllPending();
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
// Now check whether it is added to Spellchecker.
@@ -997,6 +1017,8 @@
scoped_refptr<SpellChecker> spell_checker(new SpellChecker(
hunspell_directory, "en-US", NULL, custom_dictionary_file));
+ spell_checker->Initialize();
+ message_loop_.RunAllPending();
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
// Add the word to spellchecker.
@@ -1083,6 +1105,8 @@
scoped_refptr<SpellChecker> spell_checker(new SpellChecker(
hunspell_directory, "en-US", NULL, FilePath()));
spell_checker->EnableAutoSpellCorrect(true);
+ spell_checker->Initialize();
+ message_loop_.RunAllPending();
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
string16 misspelled_word(UTF8ToUTF16(kTestCases[i].input));
@@ -1118,6 +1142,8 @@
scoped_refptr<SpellChecker> spell_checker(new SpellChecker(
hunspell_directory, "en-US", NULL, FilePath()));
+ spell_checker->Initialize();
+ message_loop_.RunAllPending();
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
string16 word(UTF8ToUTF16(kTestCases[i].input));
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.cc ('k') | chrome/browser/spellchecker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698