| OLD | NEW |
| 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 "chrome/browser/chromeos/input_method/input_method_engine.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_engine.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/metrics/histogram_samples.h" | 12 #include "base/metrics/histogram_samples.h" |
| 13 #include "base/metrics/statistics_recorder.h" | 13 #include "base/metrics/statistics_recorder.h" |
| 14 #include "base/test/histogram_tester.h" | 14 #include "base/test/histogram_tester.h" |
| 15 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 15 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| 16 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" | 16 #include "chrome/browser/chromeos/input_method/mock_input_method_manager_impl.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/browser/ui/input_method/input_method_engine_base.h" | 18 #include "chrome/browser/ui/input_method/input_method_engine_base.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "ui/base/ime/chromeos/extension_ime_util.h" | 20 #include "ui/base/ime/chromeos/extension_ime_util.h" |
| 21 #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h" | 21 #include "ui/base/ime/chromeos/mock_component_extension_ime_manager_delegate.h" |
| 22 #include "ui/base/ime/ime_bridge.h" | 22 #include "ui/base/ime/ime_bridge.h" |
| 23 #include "ui/base/ime/ime_engine_handler_interface.h" | 23 #include "ui/base/ime/ime_engine_handler_interface.h" |
| 24 #include "ui/base/ime/mock_ime_input_context_handler.h" | 24 #include "ui/base/ime/mock_ime_input_context_handler.h" |
| 25 #include "ui/base/ime/text_input_flags.h" | 25 #include "ui/base/ime/text_input_flags.h" |
| 26 #include "ui/gfx/geometry/rect.h" | 26 #include "ui/gfx/geometry/rect.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 ext1_engine1.language_codes.push_back("en-US"); | 59 ext1_engine1.language_codes.push_back("en-US"); |
| 60 ext1_engine1.layouts.push_back("us"); | 60 ext1_engine1.layouts.push_back("us"); |
| 61 ext1.engines.push_back(ext1_engine1); | 61 ext1.engines.push_back(ext1_engine1); |
| 62 | 62 |
| 63 std::vector<ComponentExtensionIME> ime_list; | 63 std::vector<ComponentExtensionIME> ime_list; |
| 64 ime_list.push_back(ext1); | 64 ime_list.push_back(ext1); |
| 65 delegate->set_ime_list(ime_list); | 65 delegate->set_ime_list(ime_list); |
| 66 comp_ime_manager->Initialize( | 66 comp_ime_manager->Initialize( |
| 67 std::unique_ptr<ComponentExtensionIMEManagerDelegate>(delegate)); | 67 std::unique_ptr<ComponentExtensionIMEManagerDelegate>(delegate)); |
| 68 | 68 |
| 69 MockInputMethodManager* manager = new MockInputMethodManager; | 69 MockInputMethodManagerImpl* manager = new MockInputMethodManagerImpl; |
| 70 manager->SetComponentExtensionIMEManager( | 70 manager->SetComponentExtensionIMEManager( |
| 71 std::unique_ptr<ComponentExtensionIMEManager>(comp_ime_manager)); | 71 std::unique_ptr<ComponentExtensionIMEManager>(comp_ime_manager)); |
| 72 InitializeForTesting(manager); | 72 InitializeForTesting(manager); |
| 73 } | 73 } |
| 74 | 74 |
| 75 class TestObserver : public InputMethodEngineBase::Observer { | 75 class TestObserver : public InputMethodEngineBase::Observer { |
| 76 public: | 76 public: |
| 77 TestObserver() : calls_bitmap_(NONE) {} | 77 TestObserver() : calls_bitmap_(NONE) {} |
| 78 ~TestObserver() override {} | 78 ~TestObserver() override {} |
| 79 | 79 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 CreateEngine(true); | 272 CreateEngine(true); |
| 273 // Enable/disable with focus. | 273 // Enable/disable with focus. |
| 274 std::vector<gfx::Rect> rects; | 274 std::vector<gfx::Rect> rects; |
| 275 rects.push_back(gfx::Rect()); | 275 rects.push_back(gfx::Rect()); |
| 276 engine_->SetCompositionBounds(rects); | 276 engine_->SetCompositionBounds(rects); |
| 277 EXPECT_EQ(ONCOMPOSITIONBOUNDSCHANGED, observer_->GetCallsBitmapAndReset()); | 277 EXPECT_EQ(ONCOMPOSITIONBOUNDSCHANGED, observer_->GetCallsBitmapAndReset()); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace input_method | 280 } // namespace input_method |
| 281 } // namespace chromeos | 281 } // namespace chromeos |
| OLD | NEW |