| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ui/base/ime/input_method_base.h" | 5 #include "ui/base/ime/input_method_base.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 12 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/base/ime/dummy_text_input_client.h" | 15 #include "ui/base/ime/dummy_text_input_client.h" |
| 15 #include "ui/base/ime/input_method_observer.h" | 16 #include "ui/base/ime/input_method_observer.h" |
| 16 #include "ui/events/event.h" | 17 #include "ui/events/event.h" |
| 17 | 18 |
| 18 namespace ui { | 19 namespace ui { |
| 19 namespace { | 20 namespace { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 protected: | 120 protected: |
| 120 InputMethodBaseTest() { | 121 InputMethodBaseTest() { |
| 121 } | 122 } |
| 122 ~InputMethodBaseTest() override {} | 123 ~InputMethodBaseTest() override {} |
| 123 | 124 |
| 124 void SetUp() override { message_loop_.reset(new base::MessageLoopForUI); } | 125 void SetUp() override { message_loop_.reset(new base::MessageLoopForUI); } |
| 125 | 126 |
| 126 void TearDown() override { message_loop_.reset(); } | 127 void TearDown() override { message_loop_.reset(); } |
| 127 | 128 |
| 128 private: | 129 private: |
| 129 scoped_ptr<base::MessageLoop> message_loop_; | 130 std::unique_ptr<base::MessageLoop> message_loop_; |
| 130 DISALLOW_COPY_AND_ASSIGN(InputMethodBaseTest); | 131 DISALLOW_COPY_AND_ASSIGN(InputMethodBaseTest); |
| 131 }; | 132 }; |
| 132 | 133 |
| 133 class MockInputMethodBase : public InputMethodBase { | 134 class MockInputMethodBase : public InputMethodBase { |
| 134 public: | 135 public: |
| 135 // Note: this class does not take the ownership of |verifier|. | 136 // Note: this class does not take the ownership of |verifier|. |
| 136 MockInputMethodBase(ClientChangeVerifier* verifier) : verifier_(verifier) { | 137 MockInputMethodBase(ClientChangeVerifier* verifier) : verifier_(verifier) { |
| 137 } | 138 } |
| 138 ~MockInputMethodBase() override {} | 139 ~MockInputMethodBase() override {} |
| 139 | 140 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 input_method.OnFocus(); | 296 input_method.OnFocus(); |
| 296 verifier.ExpectClientChange(&text_input_client, NULL); | 297 verifier.ExpectClientChange(&text_input_client, NULL); |
| 297 input_method.DetachTextInputClient(&text_input_client); | 298 input_method.DetachTextInputClient(&text_input_client); |
| 298 EXPECT_EQ(NULL, input_method.GetTextInputClient()); | 299 EXPECT_EQ(NULL, input_method.GetTextInputClient()); |
| 299 verifier.Verify(); | 300 verifier.Verify(); |
| 300 } | 301 } |
| 301 } | 302 } |
| 302 | 303 |
| 303 } // namespace | 304 } // namespace |
| 304 } // namespace ui | 305 } // namespace ui |
| OLD | NEW |