| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/common/spellcheck_messages.h" | 9 #include "chrome/common/spellcheck_messages.h" |
| 10 #include "chrome/common/spellcheck_result.h" |
| 10 #include "chrome/renderer/spellchecker/spellcheck_provider.h" | 11 #include "chrome/renderer/spellchecker/spellcheck_provider.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingComple
tion.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingComple
tion.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult
.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult
.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 // Faked test target, which stores sent message for verification, | 20 // Faked test target, which stores sent message for verification, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ¶meters.router_id, | 83 ¶meters.router_id, |
| 83 ¶meters.request_id, | 84 ¶meters.request_id, |
| 84 ¶meters.document_tag, | 85 ¶meters.document_tag, |
| 85 ¶meters.text); | 86 ¶meters.text); |
| 86 EXPECT_TRUE(ok); | 87 EXPECT_TRUE(ok); |
| 87 return parameters; | 88 return parameters; |
| 88 } | 89 } |
| 89 | 90 |
| 90 void FakeMessageArrival(SpellCheckProvider* provider, | 91 void FakeMessageArrival(SpellCheckProvider* provider, |
| 91 const MessageParameters& parameters) { | 92 const MessageParameters& parameters) { |
| 92 std::vector<WebKit::WebTextCheckingResult> fake_result; | 93 std::vector<SpellCheckResult> fake_result; |
| 93 bool handled = provider->OnMessageReceived( | 94 bool handled = provider->OnMessageReceived( |
| 94 SpellCheckMsg_RespondTextCheck( | 95 SpellCheckMsg_RespondTextCheck( |
| 95 0, | 96 0, |
| 96 parameters.request_id, | 97 parameters.request_id, |
| 97 parameters.document_tag, | 98 parameters.document_tag, |
| 98 fake_result)); | 99 fake_result)); |
| 99 EXPECT_TRUE(handled); | 100 EXPECT_TRUE(handled); |
| 100 } | 101 } |
| 101 | 102 |
| 102 TEST_F(SpellCheckProviderMacTest, SingleRoundtripSuccess) { | 103 TEST_F(SpellCheckProviderMacTest, SingleRoundtripSuccess) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 EXPECT_EQ(completion2.completion_count_, 0U); | 150 EXPECT_EQ(completion2.completion_count_, 0U); |
| 150 EXPECT_EQ(provider_.pending_text_request_size(), 1U); | 151 EXPECT_EQ(provider_.pending_text_request_size(), 1U); |
| 151 | 152 |
| 152 FakeMessageArrival(&provider_, read_parameters2); | 153 FakeMessageArrival(&provider_, read_parameters2); |
| 153 EXPECT_EQ(completion1.completion_count_, 1U); | 154 EXPECT_EQ(completion1.completion_count_, 1U); |
| 154 EXPECT_EQ(completion2.completion_count_, 1U); | 155 EXPECT_EQ(completion2.completion_count_, 1U); |
| 155 EXPECT_EQ(provider_.pending_text_request_size(), 0U); | 156 EXPECT_EQ(provider_.pending_text_request_size(), 0U); |
| 156 } | 157 } |
| 157 | 158 |
| 158 } // namespace | 159 } // namespace |
| OLD | NEW |