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

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

Issue 1136463005: Supports multiple profile in Chrome OS IMF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased. Created 5 years, 7 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"
11 #include "chrome/browser/chromeos/input_method/input_method_engine.h" 11 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
12 #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h" 12 #include "chrome/browser/chromeos/input_method/input_method_engine_interface.h"
13 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" 13 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h"
14 #include "chrome/browser/profiles/profile_manager.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "ui/base/ime/chromeos/extension_ime_util.h" 16 #include "ui/base/ime/chromeos/extension_ime_util.h"
16 #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h" 17 #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h"
17 #include "ui/base/ime/chromeos/mock_ime_input_context_handler.h" 18 #include "ui/base/ime/chromeos/mock_ime_input_context_handler.h"
18 #include "ui/base/ime/text_input_flags.h" 19 #include "ui/base/ime/text_input_flags.h"
19 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
20 21
21 namespace chromeos { 22 namespace chromeos {
22 23
23 namespace input_method { 24 namespace input_method {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 engine_.reset(); 130 engine_.reset();
130 Shutdown(); 131 Shutdown();
131 } 132 }
132 133
133 protected: 134 protected:
134 void CreateEngine(bool whitelisted) { 135 void CreateEngine(bool whitelisted) {
135 engine_.reset(new InputMethodEngine()); 136 engine_.reset(new InputMethodEngine());
136 observer_ = new TestObserver(); 137 observer_ = new TestObserver();
137 scoped_ptr<InputMethodEngineInterface::Observer> observer_ptr(observer_); 138 scoped_ptr<InputMethodEngineInterface::Observer> observer_ptr(observer_);
138 engine_->Initialize(observer_ptr.Pass(), 139 engine_->Initialize(observer_ptr.Pass(),
139 whitelisted ? kTestExtensionId : kTestExtensionId2); 140 whitelisted ? kTestExtensionId : kTestExtensionId2,
141 ProfileManager::GetActiveUserProfile());
140 } 142 }
141 143
142 void FocusIn(ui::TextInputType input_type) { 144 void FocusIn(ui::TextInputType input_type) {
143 IMEEngineHandlerInterface::InputContext input_context( 145 IMEEngineHandlerInterface::InputContext input_context(
144 input_type, ui::TEXT_INPUT_MODE_DEFAULT, ui::TEXT_INPUT_FLAG_NONE); 146 input_type, ui::TEXT_INPUT_MODE_DEFAULT, ui::TEXT_INPUT_FLAG_NONE);
145 engine_->FocusIn(input_context); 147 engine_->FocusIn(input_context);
146 IMEBridge::Get()->SetCurrentInputContext(input_context); 148 IMEBridge::Get()->SetCurrentInputContext(input_context);
147 } 149 }
148 150
149 scoped_ptr<InputMethodEngine> engine_; 151 scoped_ptr<InputMethodEngine> engine_;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // Enable/disable with focus. 259 // Enable/disable with focus.
258 std::vector<gfx::Rect> rects; 260 std::vector<gfx::Rect> rects;
259 rects.push_back(gfx::Rect()); 261 rects.push_back(gfx::Rect());
260 engine_->SetCompositionBounds(rects); 262 engine_->SetCompositionBounds(rects);
261 EXPECT_EQ(ONCOMPOSITIONBOUNDSCHANGED, 263 EXPECT_EQ(ONCOMPOSITIONBOUNDSCHANGED,
262 observer_->GetCallsBitmapAndReset()); 264 observer_->GetCallsBitmapAndReset());
263 } 265 }
264 266
265 } // namespace input_method 267 } // namespace input_method
266 } // namespace chromeos 268 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698