OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 6 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
7 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" | 7 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
8 #include "chrome/browser/spellchecker/spellcheck_service.h" | 8 #include "chrome/browser/spellchecker/spellcheck_service.h" |
9 #include "chrome/common/spellcheck_marker.h" | 9 #include "chrome/common/spellcheck_marker.h" |
10 #include "chrome/common/spellcheck_messages.h" | 10 #include "chrome/common/spellcheck_messages.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 SpellCheckHostMsg_RespondDocumentMarkers::ID, | 59 SpellCheckHostMsg_RespondDocumentMarkers::ID, |
60 #if !defined(OS_MACOSX) | 60 #if !defined(OS_MACOSX) |
61 SpellCheckHostMsg_CallSpellingService::ID, | 61 SpellCheckHostMsg_CallSpellingService::ID, |
62 #endif | 62 #endif |
63 }; | 63 }; |
64 content::BrowserThread::ID thread; | 64 content::BrowserThread::ID thread; |
65 IPC::Message message; | 65 IPC::Message message; |
66 scoped_refptr<TestingSpellCheckMessageFilter> filter( | 66 scoped_refptr<TestingSpellCheckMessageFilter> filter( |
67 new TestingSpellCheckMessageFilter); | 67 new TestingSpellCheckMessageFilter); |
68 for (size_t i = 0; i < arraysize(kSpellcheckMessages); ++i) { | 68 for (size_t i = 0; i < arraysize(kSpellcheckMessages); ++i) { |
69 message.SetHeaderValues( | 69 message.SetHeaderValues(0, kSpellcheckMessages[i], 0 /* flags */); |
70 0, kSpellcheckMessages[i], IPC::Message::PRIORITY_NORMAL); | |
71 thread = content::BrowserThread::IO; | 70 thread = content::BrowserThread::IO; |
72 filter->OverrideThreadForMessage(message, &thread); | 71 filter->OverrideThreadForMessage(message, &thread); |
73 EXPECT_EQ(content::BrowserThread::UI, thread); | 72 EXPECT_EQ(content::BrowserThread::UI, thread); |
74 } | 73 } |
75 } | 74 } |
76 | 75 |
77 #if !defined(OS_MACOSX) | 76 #if !defined(OS_MACOSX) |
78 TEST(SpellCheckMessageFilterTest, OnTextCheckCompleteTestCustomDictionary) { | 77 TEST(SpellCheckMessageFilterTest, OnTextCheckCompleteTestCustomDictionary) { |
79 static const std::string kCustomWord = "Helllo"; | 78 static const std::string kCustomWord = "Helllo"; |
80 static const int kRouteId = 0; | 79 static const int kRouteId = 0; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 std::vector<SpellCheckResult> sent_results; | 139 std::vector<SpellCheckResult> sent_results; |
141 bool ok = SpellCheckMsg_RespondSpellingService::Read(filter->sent_messages[0], | 140 bool ok = SpellCheckMsg_RespondSpellingService::Read(filter->sent_messages[0], |
142 &sent_identifier, | 141 &sent_identifier, |
143 &sent_success, | 142 &sent_success, |
144 &sent_text, | 143 &sent_text, |
145 &sent_results); | 144 &sent_results); |
146 EXPECT_TRUE(ok); | 145 EXPECT_TRUE(ok); |
147 EXPECT_EQ(static_cast<size_t>(2), sent_results.size()); | 146 EXPECT_EQ(static_cast<size_t>(2), sent_results.size()); |
148 } | 147 } |
149 #endif | 148 #endif |
OLD | NEW |