| 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(0, kSpellcheckMessages[i], 0 /* flags */); | 69 message.SetHeaderValues( |
| 70 0, kSpellcheckMessages[i], IPC::Message::PRIORITY_NORMAL); |
| 70 thread = content::BrowserThread::IO; | 71 thread = content::BrowserThread::IO; |
| 71 filter->OverrideThreadForMessage(message, &thread); | 72 filter->OverrideThreadForMessage(message, &thread); |
| 72 EXPECT_EQ(content::BrowserThread::UI, thread); | 73 EXPECT_EQ(content::BrowserThread::UI, thread); |
| 73 } | 74 } |
| 74 } | 75 } |
| 75 | 76 |
| 76 #if !defined(OS_MACOSX) | 77 #if !defined(OS_MACOSX) |
| 77 TEST(SpellCheckMessageFilterTest, OnTextCheckCompleteTestCustomDictionary) { | 78 TEST(SpellCheckMessageFilterTest, OnTextCheckCompleteTestCustomDictionary) { |
| 78 static const std::string kCustomWord = "Helllo"; | 79 static const std::string kCustomWord = "Helllo"; |
| 79 static const int kRouteId = 0; | 80 static const int kRouteId = 0; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 std::vector<SpellCheckResult> sent_results; | 140 std::vector<SpellCheckResult> sent_results; |
| 140 bool ok = SpellCheckMsg_RespondSpellingService::Read(filter->sent_messages[0], | 141 bool ok = SpellCheckMsg_RespondSpellingService::Read(filter->sent_messages[0], |
| 141 &sent_identifier, | 142 &sent_identifier, |
| 142 &sent_success, | 143 &sent_success, |
| 143 &sent_text, | 144 &sent_text, |
| 144 &sent_results); | 145 &sent_results); |
| 145 EXPECT_TRUE(ok); | 146 EXPECT_TRUE(ok); |
| 146 EXPECT_EQ(static_cast<size_t>(2), sent_results.size()); | 147 EXPECT_EQ(static_cast<size_t>(2), sent_results.size()); |
| 147 } | 148 } |
| 148 #endif | 149 #endif |
| OLD | NEW |