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

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

Issue 11956008: Move SetCursorLocation bypass code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittests: add TextInputTestSupport initialzation Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_manager_impl.h" 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop.h"
13 #include "chrome/browser/chromeos/input_method/mock_candidate_window_controller. h" 14 #include "chrome/browser/chromeos/input_method/mock_candidate_window_controller. h"
14 #include "chrome/browser/chromeos/input_method/mock_ibus_controller.h" 15 #include "chrome/browser/chromeos/input_method/mock_ibus_controller.h"
15 #include "chrome/browser/chromeos/input_method/mock_input_method_delegate.h" 16 #include "chrome/browser/chromeos/input_method/mock_input_method_delegate.h"
16 #include "chrome/browser/chromeos/input_method/mock_xkeyboard.h" 17 #include "chrome/browser/chromeos/input_method/mock_xkeyboard.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "ui/base/accelerators/accelerator.h" 19 #include "ui/base/accelerators/accelerator.h"
20 #include "ui/base/ime/text_input_test_support.h"
19 #include "ui/base/keycodes/keyboard_codes.h" 21 #include "ui/base/keycodes/keyboard_codes.h"
20 22
21 namespace chromeos { 23 namespace chromeos {
22 24
23 extern const char* kExtensionImePrefix; 25 extern const char* kExtensionImePrefix;
24 26
25 namespace input_method { 27 namespace input_method {
26 namespace { 28 namespace {
27 29
28 class InputMethodManagerImplTest : public testing::Test { 30 class InputMethodManagerImplTest : public testing::Test {
29 public: 31 public:
30 InputMethodManagerImplTest() 32 InputMethodManagerImplTest()
31 : delegate_(NULL), 33 : delegate_(NULL),
32 controller_(NULL), 34 controller_(NULL),
33 candidate_window_controller_(NULL), 35 candidate_window_controller_(NULL),
34 xkeyboard_(NULL) { 36 xkeyboard_(NULL) {
35 } 37 }
36 virtual ~InputMethodManagerImplTest() {} 38 virtual ~InputMethodManagerImplTest() {}
37 39
38 virtual void SetUp() OVERRIDE { 40 virtual void SetUp() OVERRIDE {
41 ui::TextInputTestSupport::Initialize();
39 delegate_ = new MockInputMethodDelegate(); 42 delegate_ = new MockInputMethodDelegate();
40 manager_.reset(new InputMethodManagerImpl( 43 manager_.reset(new InputMethodManagerImpl(
41 scoped_ptr<InputMethodDelegate>(delegate_))); 44 scoped_ptr<InputMethodDelegate>(delegate_)));
42 controller_ = new MockIBusController; 45 controller_ = new MockIBusController;
43 manager_->SetIBusControllerForTesting(controller_); 46 manager_->SetIBusControllerForTesting(controller_);
44 candidate_window_controller_ = new MockCandidateWindowController; 47 candidate_window_controller_ = new MockCandidateWindowController;
45 manager_->SetCandidateWindowControllerForTesting( 48 manager_->SetCandidateWindowControllerForTesting(
46 candidate_window_controller_); 49 candidate_window_controller_);
47 xkeyboard_ = new MockXKeyboard; 50 xkeyboard_ = new MockXKeyboard;
48 manager_->SetXKeyboardForTesting(xkeyboard_); 51 manager_->SetXKeyboardForTesting(xkeyboard_);
49 } 52 }
50 53
51 virtual void TearDown() OVERRIDE { 54 virtual void TearDown() OVERRIDE {
52 delegate_ = NULL; 55 delegate_ = NULL;
53 controller_ = NULL; 56 controller_ = NULL;
54 candidate_window_controller_ = NULL; 57 candidate_window_controller_ = NULL;
55 xkeyboard_ = NULL; 58 xkeyboard_ = NULL;
56 manager_.reset(); 59 manager_.reset();
60 ui::TextInputTestSupport::Shutdown();
57 } 61 }
58 62
59 protected: 63 protected:
60 scoped_ptr<InputMethodManagerImpl> manager_; 64 scoped_ptr<InputMethodManagerImpl> manager_;
61 MockInputMethodDelegate* delegate_; 65 MockInputMethodDelegate* delegate_;
62 MockIBusController* controller_; 66 MockIBusController* controller_;
63 MockCandidateWindowController* candidate_window_controller_; 67 MockCandidateWindowController* candidate_window_controller_;
64 MockXKeyboard* xkeyboard_; 68 MockXKeyboard* xkeyboard_;
69 MessageLoop message_loop_;
65 70
66 private: 71 private:
67 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImplTest); 72 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImplTest);
68 }; 73 };
69 74
70 class TestObserver : public InputMethodManager::Observer { 75 class TestObserver : public InputMethodManager::Observer {
71 public: 76 public:
72 TestObserver() 77 TestObserver()
73 : input_method_changed_count_(0), 78 : input_method_changed_count_(0),
74 input_method_property_changed_count_(0), 79 input_method_property_changed_count_(0),
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 EXPECT_EQ("mozc", controller_->change_input_method_id_); 989 EXPECT_EQ("mozc", controller_->change_input_method_id_);
985 EXPECT_EQ(1, controller_->reset_count_); 990 EXPECT_EQ(1, controller_->reset_count_);
986 manager_->ChangeInputMethod("xkb:us::eng"); 991 manager_->ChangeInputMethod("xkb:us::eng");
987 EXPECT_EQ(2, controller_->change_input_method_count_); 992 EXPECT_EQ(2, controller_->change_input_method_count_);
988 EXPECT_EQ("mozc", controller_->change_input_method_id_); 993 EXPECT_EQ("mozc", controller_->change_input_method_id_);
989 EXPECT_EQ(1, controller_->reset_count_); 994 EXPECT_EQ(1, controller_->reset_count_);
990 } 995 }
991 996
992 } // namespace input_method 997 } // namespace input_method
993 } // namespace chromeos 998 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/input_method/input_method_manager_impl.cc ('k') | chromeos/dbus/ibus/ibus_panel_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698