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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
| 8 #include "base/macros.h" |
5 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
6 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 10 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
7 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" | 11 #include "chrome/browser/spellchecker/spellcheck_message_filter.h" |
8 #include "chrome/browser/spellchecker/spellcheck_service.h" | 12 #include "chrome/browser/spellchecker/spellcheck_service.h" |
9 #include "chrome/common/spellcheck_marker.h" | 13 #include "chrome/common/spellcheck_marker.h" |
10 #include "chrome/common/spellcheck_messages.h" | 14 #include "chrome/common/spellcheck_messages.h" |
11 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
12 #include "content/public/test/test_browser_thread_bundle.h" | 16 #include "content/public/test/test_browser_thread_bundle.h" |
13 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 ~TestingSpellCheckMessageFilter() override {} | 50 ~TestingSpellCheckMessageFilter() override {} |
47 | 51 |
48 content::TestBrowserThreadBundle thread_bundle_; | 52 content::TestBrowserThreadBundle thread_bundle_; |
49 TestingProfile profile_; | 53 TestingProfile profile_; |
50 scoped_ptr<SpellcheckService> spellcheck_; | 54 scoped_ptr<SpellcheckService> spellcheck_; |
51 | 55 |
52 DISALLOW_COPY_AND_ASSIGN(TestingSpellCheckMessageFilter); | 56 DISALLOW_COPY_AND_ASSIGN(TestingSpellCheckMessageFilter); |
53 }; | 57 }; |
54 | 58 |
55 TEST(SpellCheckMessageFilterTest, TestOverrideThread) { | 59 TEST(SpellCheckMessageFilterTest, TestOverrideThread) { |
56 static const uint32 kSpellcheckMessages[] = { | 60 static const uint32_t kSpellcheckMessages[] = { |
57 SpellCheckHostMsg_RequestDictionary::ID, | 61 SpellCheckHostMsg_RequestDictionary::ID, |
58 SpellCheckHostMsg_NotifyChecked::ID, | 62 SpellCheckHostMsg_NotifyChecked::ID, |
59 SpellCheckHostMsg_RespondDocumentMarkers::ID, | 63 SpellCheckHostMsg_RespondDocumentMarkers::ID, |
60 #if !defined(USE_BROWSER_SPELLCHECKER) | 64 #if !defined(USE_BROWSER_SPELLCHECKER) |
61 SpellCheckHostMsg_CallSpellingService::ID, | 65 SpellCheckHostMsg_CallSpellingService::ID, |
62 #endif | 66 #endif |
63 }; | 67 }; |
64 content::BrowserThread::ID thread; | 68 content::BrowserThread::ID thread; |
65 IPC::Message message; | 69 IPC::Message message; |
66 scoped_refptr<TestingSpellCheckMessageFilter> filter( | 70 scoped_refptr<TestingSpellCheckMessageFilter> filter( |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 138 |
135 SpellCheckMsg_RespondSpellingService::Param params; | 139 SpellCheckMsg_RespondSpellingService::Param params; |
136 bool ok = SpellCheckMsg_RespondSpellingService::Read( | 140 bool ok = SpellCheckMsg_RespondSpellingService::Read( |
137 filter->sent_messages[0], & params); | 141 filter->sent_messages[0], & params); |
138 base::string16 sent_text = base::get<2>(params); | 142 base::string16 sent_text = base::get<2>(params); |
139 std::vector<SpellCheckResult> sent_results = base::get<3>(params); | 143 std::vector<SpellCheckResult> sent_results = base::get<3>(params); |
140 EXPECT_TRUE(ok); | 144 EXPECT_TRUE(ok); |
141 EXPECT_EQ(static_cast<size_t>(2), sent_results.size()); | 145 EXPECT_EQ(static_cast<size_t>(2), sent_results.size()); |
142 } | 146 } |
143 #endif | 147 #endif |
OLD | NEW |