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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_engine_unittest.cc

Issue 796693005: Update {virtual,override,final} to follow C++11 style in chrome/browser/chromeos/input_method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/logging.h" 5 #include "base/logging.h"
6 #include "base/metrics/histogram.h" 6 #include "base/metrics/histogram.h"
7 #include "base/metrics/histogram_samples.h" 7 #include "base/metrics/histogram_samples.h"
8 #include "base/metrics/statistics_recorder.h" 8 #include "base/metrics/statistics_recorder.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" 10 #include "chrome/browser/chromeos/input_method/input_method_configuration.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 MockInputMethodManager* manager = new MockInputMethodManager; 60 MockInputMethodManager* manager = new MockInputMethodManager;
61 manager->SetComponentExtensionIMEManager( 61 manager->SetComponentExtensionIMEManager(
62 scoped_ptr<ComponentExtensionIMEManager>(comp_ime_manager).Pass()); 62 scoped_ptr<ComponentExtensionIMEManager>(comp_ime_manager).Pass());
63 InitializeForTesting(manager); 63 InitializeForTesting(manager);
64 } 64 }
65 65
66 class TestObserver : public InputMethodEngineInterface::Observer { 66 class TestObserver : public InputMethodEngineInterface::Observer {
67 public: 67 public:
68 TestObserver() : calls_bitmap_(NONE) {} 68 TestObserver() : calls_bitmap_(NONE) {}
69 virtual ~TestObserver() {} 69 ~TestObserver() override {}
70 70
71 virtual void OnActivate(const std::string& engine_id) override { 71 void OnActivate(const std::string& engine_id) override {
72 calls_bitmap_ |= ACTIVATE; 72 calls_bitmap_ |= ACTIVATE;
73 } 73 }
74 virtual void OnDeactivated(const std::string& engine_id) override { 74 void OnDeactivated(const std::string& engine_id) override {
75 calls_bitmap_ |= DEACTIVATED; 75 calls_bitmap_ |= DEACTIVATED;
76 } 76 }
77 virtual void OnFocus( 77 void OnFocus(
78 const InputMethodEngineInterface::InputContext& context) override { 78 const InputMethodEngineInterface::InputContext& context) override {
79 calls_bitmap_ |= ONFOCUS; 79 calls_bitmap_ |= ONFOCUS;
80 } 80 }
81 virtual void OnBlur(int context_id) override { 81 void OnBlur(int context_id) override { calls_bitmap_ |= ONBLUR; }
82 calls_bitmap_ |= ONBLUR; 82 void OnKeyEvent(const std::string& engine_id,
83 } 83 const InputMethodEngineInterface::KeyboardEvent& event,
84 virtual void OnKeyEvent( 84 input_method::KeyEventHandle* key_data) override {}
85 const std::string& engine_id, 85 void OnInputContextUpdate(
86 const InputMethodEngineInterface::KeyboardEvent& event,
87 input_method::KeyEventHandle* key_data) override {}
88 virtual void OnInputContextUpdate(
89 const InputMethodEngineInterface::InputContext& context) override {} 86 const InputMethodEngineInterface::InputContext& context) override {}
90 virtual void OnCandidateClicked( 87 void OnCandidateClicked(
91 const std::string& engine_id, 88 const std::string& engine_id,
92 int candidate_id, 89 int candidate_id,
93 InputMethodEngineInterface::MouseButtonEvent button) override {} 90 InputMethodEngineInterface::MouseButtonEvent button) override {}
94 virtual void OnMenuItemActivated( 91 void OnMenuItemActivated(const std::string& engine_id,
95 const std::string& engine_id, 92 const std::string& menu_id) override {}
96 const std::string& menu_id) override {} 93 void OnSurroundingTextChanged(const std::string& engine_id,
97 virtual void OnSurroundingTextChanged( 94 const std::string& text,
98 const std::string& engine_id, 95 int cursor_pos,
99 const std::string& text, 96 int anchor_pos) override {}
100 int cursor_pos, 97 void OnCompositionBoundsChanged(const gfx::Rect& bounds) override {
101 int anchor_pos) override {}
102 virtual void OnCompositionBoundsChanged(const gfx::Rect& bounds) override {
103 calls_bitmap_ |= ONCOMPOSITIONBOUNDSCHANGED; 98 calls_bitmap_ |= ONCOMPOSITIONBOUNDSCHANGED;
104 } 99 }
105 virtual void OnReset(const std::string& engine_id) override {} 100 void OnReset(const std::string& engine_id) override {}
106 101
107 unsigned char GetCallsBitmapAndReset() { 102 unsigned char GetCallsBitmapAndReset() {
108 unsigned char ret = calls_bitmap_; 103 unsigned char ret = calls_bitmap_;
109 calls_bitmap_ = NONE; 104 calls_bitmap_ = NONE;
110 return ret; 105 return ret;
111 } 106 }
112 107
113 private: 108 private:
114 unsigned char calls_bitmap_; 109 unsigned char calls_bitmap_;
115 110
116 DISALLOW_COPY_AND_ASSIGN(TestObserver); 111 DISALLOW_COPY_AND_ASSIGN(TestObserver);
117 }; 112 };
118 113
119 class InputMethodEngineTest : public testing::Test { 114 class InputMethodEngineTest : public testing::Test {
120 public: 115 public:
121 InputMethodEngineTest() : observer_(NULL), input_view_("inputview.html") { 116 InputMethodEngineTest() : observer_(NULL), input_view_("inputview.html") {
122 languages_.push_back("en-US"); 117 languages_.push_back("en-US");
123 layouts_.push_back("us"); 118 layouts_.push_back("us");
124 InitInputMethod(); 119 InitInputMethod();
125 IMEBridge::Initialize(); 120 IMEBridge::Initialize();
126 mock_ime_input_context_handler_.reset(new MockIMEInputContextHandler()); 121 mock_ime_input_context_handler_.reset(new MockIMEInputContextHandler());
127 IMEBridge::Get()->SetInputContextHandler( 122 IMEBridge::Get()->SetInputContextHandler(
128 mock_ime_input_context_handler_.get()); 123 mock_ime_input_context_handler_.get());
129 } 124 }
130 virtual ~InputMethodEngineTest() { 125 ~InputMethodEngineTest() override {
131 IMEBridge::Get()->SetInputContextHandler(NULL); 126 IMEBridge::Get()->SetInputContextHandler(NULL);
132 engine_.reset(); 127 engine_.reset();
133 Shutdown(); 128 Shutdown();
134 } 129 }
135 130
136 protected: 131 protected:
137 void CreateEngine(bool whitelisted) { 132 void CreateEngine(bool whitelisted) {
138 engine_.reset(new InputMethodEngine()); 133 engine_.reset(new InputMethodEngine());
139 observer_ = new TestObserver(); 134 observer_ = new TestObserver();
140 scoped_ptr<InputMethodEngineInterface::Observer> observer_ptr(observer_); 135 scoped_ptr<InputMethodEngineInterface::Observer> observer_ptr(observer_);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 TEST_F(InputMethodEngineTest, TestCompositionBoundsChanged) { 253 TEST_F(InputMethodEngineTest, TestCompositionBoundsChanged) {
259 CreateEngine(true); 254 CreateEngine(true);
260 // Enable/disable with focus. 255 // Enable/disable with focus.
261 engine_->SetCompositionBounds(gfx::Rect()); 256 engine_->SetCompositionBounds(gfx::Rect());
262 EXPECT_EQ(ONCOMPOSITIONBOUNDSCHANGED, 257 EXPECT_EQ(ONCOMPOSITIONBOUNDSCHANGED,
263 observer_->GetCallsBitmapAndReset()); 258 observer_->GetCallsBitmapAndReset());
264 } 259 }
265 260
266 } // namespace input_method 261 } // namespace input_method
267 } // namespace chromeos 262 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698