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 "chrome/browser/spellchecker/spellcheck_message_filter_platform.h" | 5 #include "chrome/browser/spellchecker/spellcheck_message_filter_platform.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
7 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/common/spellcheck_messages.h" | 12 #include "chrome/common/spellcheck_messages.h" |
9 #include "chrome/common/spellcheck_result.h" | 13 #include "chrome/common/spellcheck_result.h" |
10 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
11 #include "ipc/ipc_message.h" | 15 #include "ipc/ipc_message.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
13 | 17 |
14 namespace { | 18 namespace { |
15 | 19 |
16 TEST(SpellcheckMessageFilterPlatformMacTest, CombineResults) { | 20 TEST(SpellcheckMessageFilterPlatformMacTest, CombineResults) { |
(...skipping 21 matching lines...) Expand all Loading... |
38 | 42 |
39 ASSERT_EQ(2U, remote_results.size()); | 43 ASSERT_EQ(2U, remote_results.size()); |
40 EXPECT_EQ(SpellCheckResult::GRAMMAR, remote_results[0].decoration); | 44 EXPECT_EQ(SpellCheckResult::GRAMMAR, remote_results[0].decoration); |
41 EXPECT_EQ(0, remote_results[0].location); | 45 EXPECT_EQ(0, remote_results[0].location); |
42 EXPECT_EQ(SpellCheckResult::SPELLING, remote_results[1].decoration); | 46 EXPECT_EQ(SpellCheckResult::SPELLING, remote_results[1].decoration); |
43 EXPECT_EQ(20, remote_results[1].location); | 47 EXPECT_EQ(20, remote_results[1].location); |
44 EXPECT_EQ(remote_suggestion, remote_results[1].replacement); | 48 EXPECT_EQ(remote_suggestion, remote_results[1].replacement); |
45 } | 49 } |
46 | 50 |
47 TEST(SpellCheckMessageFilterPlatformMacTest, TestOverrideThread) { | 51 TEST(SpellCheckMessageFilterPlatformMacTest, TestOverrideThread) { |
48 static const uint32 kSpellcheckMessages[] = { | 52 static const uint32_t kSpellcheckMessages[] = { |
49 SpellCheckHostMsg_RequestTextCheck::ID, | 53 SpellCheckHostMsg_RequestTextCheck::ID, |
50 }; | 54 }; |
51 scoped_refptr<SpellCheckMessageFilterPlatform> filter( | 55 scoped_refptr<SpellCheckMessageFilterPlatform> filter( |
52 new SpellCheckMessageFilterPlatform(0)); | 56 new SpellCheckMessageFilterPlatform(0)); |
53 content::BrowserThread::ID thread; | 57 content::BrowserThread::ID thread; |
54 IPC::Message message; | 58 IPC::Message message; |
55 for (size_t i = 0; i < arraysize(kSpellcheckMessages); ++i) { | 59 for (size_t i = 0; i < arraysize(kSpellcheckMessages); ++i) { |
56 message.SetHeaderValues( | 60 message.SetHeaderValues( |
57 0, kSpellcheckMessages[i], IPC::Message::PRIORITY_NORMAL); | 61 0, kSpellcheckMessages[i], IPC::Message::PRIORITY_NORMAL); |
58 thread = content::BrowserThread::IO; | 62 thread = content::BrowserThread::IO; |
59 filter->OverrideThreadForMessage(message, &thread); | 63 filter->OverrideThreadForMessage(message, &thread); |
60 EXPECT_EQ(content::BrowserThread::UI, thread); | 64 EXPECT_EQ(content::BrowserThread::UI, thread); |
61 } | 65 } |
62 } | 66 } |
63 | 67 |
64 } // namespace | 68 } // namespace |
OLD | NEW |