Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(770)

Side by Side Diff: chrome/browser/spellchecker/spellcheck_message_filter_unittest.cc

Issue 648653003: Standardize usage of virtual/override/final in chrome/browser/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 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 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) {
38 SpellCheckMessageFilter::OnTextCheckComplete( 38 SpellCheckMessageFilter::OnTextCheckComplete(
39 route_id, identifier, markers, success, text, results); 39 route_id, identifier, markers, success, text, results);
40 } 40 }
41 #endif 41 #endif
42 42
43 ScopedVector<IPC::Message> sent_messages; 43 ScopedVector<IPC::Message> sent_messages;
44 44
45 private: 45 private:
46 virtual ~TestingSpellCheckMessageFilter() {} 46 ~TestingSpellCheckMessageFilter() override {}
47 47
48 content::TestBrowserThreadBundle thread_bundle_; 48 content::TestBrowserThreadBundle thread_bundle_;
49 TestingProfile profile_; 49 TestingProfile profile_;
50 scoped_ptr<SpellcheckService> spellcheck_; 50 scoped_ptr<SpellcheckService> spellcheck_;
51 51
52 DISALLOW_COPY_AND_ASSIGN(TestingSpellCheckMessageFilter); 52 DISALLOW_COPY_AND_ASSIGN(TestingSpellCheckMessageFilter);
53 }; 53 };
54 54
55 TEST(SpellCheckMessageFilterTest, TestOverrideThread) { 55 TEST(SpellCheckMessageFilterTest, TestOverrideThread) {
56 static const uint32 kSpellcheckMessages[] = { 56 static const uint32 kSpellcheckMessages[] = {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698