| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/ime/ime_native_window.h" | 7 #include "chrome/browser/ui/ime/ime_native_window.h" |
| 8 #include "chrome/browser/ui/ime/ime_window.h" | 8 #include "chrome/browser/ui/ime/ime_window.h" |
| 9 #include "chrome/browser/ui/ime/ime_window_observer.h" | 9 #include "chrome/browser/ui/ime/ime_window_observer.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 message_loop_runner_->Quit(); | 33 message_loop_runner_->Quit(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void WaitForWindowClosing() { | 36 void WaitForWindowClosing() { |
| 37 message_loop_runner_.reset(new base::RunLoop); | 37 message_loop_runner_.reset(new base::RunLoop); |
| 38 message_loop_runner_->Run(); | 38 message_loop_runner_->Run(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void CreateImeWindow(const gfx::Rect& bounds, bool follow_cursor) { | 41 void CreateImeWindow(const gfx::Rect& bounds, bool follow_cursor) { |
| 42 ime_window_ = new ImeWindow( | 42 ime_window_ = new ImeWindow( |
| 43 browser()->profile(), nullptr, "about:blank", | 43 browser()->profile(), nullptr, nullptr, "about:blank", |
| 44 follow_cursor ? ImeWindow::FOLLOW_CURSOR : ImeWindow::NORMAL, bounds); | 44 follow_cursor ? ImeWindow::FOLLOW_CURSOR : ImeWindow::NORMAL, bounds); |
| 45 ime_window_->AddObserver(this); | 45 ime_window_->AddObserver(this); |
| 46 EXPECT_FALSE(ime_window_->ime_native_window()->IsVisible()); | 46 EXPECT_FALSE(ime_window_->ime_native_window()->IsVisible()); |
| 47 ime_window_->Show(); | 47 ime_window_->Show(); |
| 48 EXPECT_TRUE(ime_window_->ime_native_window()->IsVisible()); | 48 EXPECT_TRUE(ime_window_->ime_native_window()->IsVisible()); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void VerifyImeWindow(const gfx::Rect& expected_bounds) { | 51 void VerifyImeWindow(const gfx::Rect& expected_bounds) { |
| 52 EXPECT_EQ(expected_bounds, | 52 EXPECT_EQ(expected_bounds, |
| 53 ime_window_->ime_native_window()->GetBounds()); | 53 ime_window_->ime_native_window()->GetBounds()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 77 gfx::Rect expected_bounds(100, 200, 100, 100); | 77 gfx::Rect expected_bounds(100, 200, 100, 100); |
| 78 CreateImeWindow(expected_bounds, true); | 78 CreateImeWindow(expected_bounds, true); |
| 79 ime_window_->FollowCursor(gfx::Rect(10, 20, 1, 10)); | 79 ime_window_->FollowCursor(gfx::Rect(10, 20, 1, 10)); |
| 80 expected_bounds.set_x(10); // cursor left. | 80 expected_bounds.set_x(10); // cursor left. |
| 81 expected_bounds.set_y(33); // cursor top + cursor height + margin(3). | 81 expected_bounds.set_y(33); // cursor top + cursor height + margin(3). |
| 82 VerifyImeWindow(expected_bounds); | 82 VerifyImeWindow(expected_bounds); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace test | 85 } // namespace test |
| 86 } // namespace ui | 86 } // namespace ui |
| OLD | NEW |