| 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" |
| 11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
| 12 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
| 13 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 class TestingSpellCheckMessageFilter : public SpellCheckMessageFilter { | 16 class TestingSpellCheckMessageFilter : public SpellCheckMessageFilter { |
| 17 public: | 17 public: |
| 18 TestingSpellCheckMessageFilter() | 18 TestingSpellCheckMessageFilter() |
| 19 : SpellCheckMessageFilter(0), | 19 : SpellCheckMessageFilter(0), |
| 20 spellcheck_(new SpellcheckService(&profile_)) {} | 20 spellcheck_(new SpellcheckService(&profile_)) {} |
| 21 | 21 |
| 22 virtual bool Send(IPC::Message* message) OVERRIDE { | 22 virtual bool Send(IPC::Message* message) override { |
| 23 sent_messages.push_back(message); | 23 sent_messages.push_back(message); |
| 24 return true; | 24 return true; |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual SpellcheckService* GetSpellcheckService() const OVERRIDE { | 27 virtual SpellcheckService* GetSpellcheckService() const override { |
| 28 return spellcheck_.get(); | 28 return spellcheck_.get(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 #if !defined(OS_MACOSX) | 31 #if !defined(OS_MACOSX) |
| 32 void OnTextCheckComplete(int route_id, | 32 void OnTextCheckComplete(int route_id, |
| 33 int identifier, | 33 int identifier, |
| 34 const std::vector<SpellCheckMarker>& markers, | 34 const std::vector<SpellCheckMarker>& markers, |
| 35 bool success, | 35 bool success, |
| 36 const base::string16& text, | 36 const base::string16& text, |
| 37 const std::vector<SpellCheckResult>& results) { | 37 const std::vector<SpellCheckResult>& results) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 SpellCheckMsg_RespondSpellingService::Param params; | 135 SpellCheckMsg_RespondSpellingService::Param params; |
| 136 bool ok = SpellCheckMsg_RespondSpellingService::Read( | 136 bool ok = SpellCheckMsg_RespondSpellingService::Read( |
| 137 filter->sent_messages[0], & params); | 137 filter->sent_messages[0], & params); |
| 138 base::string16 sent_text = params.c; | 138 base::string16 sent_text = params.c; |
| 139 std::vector<SpellCheckResult> sent_results = params.d; | 139 std::vector<SpellCheckResult> sent_results = params.d; |
| 140 EXPECT_TRUE(ok); | 140 EXPECT_TRUE(ok); |
| 141 EXPECT_EQ(static_cast<size_t>(2), sent_results.size()); | 141 EXPECT_EQ(static_cast<size_t>(2), sent_results.size()); |
| 142 } | 142 } |
| 143 #endif | 143 #endif |
| OLD | NEW |