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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()); |
54 EXPECT_GT(ime_window_->GetFrameId(), 0); | 54 EXPECT_GT(ime_window_->GetFrameId(), 0); |
55 } | 55 } |
56 | 56 |
57 ImeWindow* ime_window_; | 57 ImeWindow* ime_window_; |
58 | 58 |
59 scoped_ptr<base::RunLoop> message_loop_runner_; | 59 std::unique_ptr<base::RunLoop> message_loop_runner_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(ImeWindowBrowserTest); | 61 DISALLOW_COPY_AND_ASSIGN(ImeWindowBrowserTest); |
62 }; | 62 }; |
63 | 63 |
64 IN_PROC_BROWSER_TEST_F(ImeWindowBrowserTest, CreateNormalWindow) { | 64 IN_PROC_BROWSER_TEST_F(ImeWindowBrowserTest, CreateNormalWindow) { |
65 gfx::Rect expected_bounds(100, 200, 300, 400); | 65 gfx::Rect expected_bounds(100, 200, 300, 400); |
66 CreateImeWindow(expected_bounds, false); | 66 CreateImeWindow(expected_bounds, false); |
67 VerifyImeWindow(expected_bounds); | 67 VerifyImeWindow(expected_bounds); |
68 } | 68 } |
69 | 69 |
70 IN_PROC_BROWSER_TEST_F(ImeWindowBrowserTest, CreateFollowCursorWindow) { | 70 IN_PROC_BROWSER_TEST_F(ImeWindowBrowserTest, CreateFollowCursorWindow) { |
71 gfx::Rect expected_bounds(100, 200, 300, 400); | 71 gfx::Rect expected_bounds(100, 200, 300, 400); |
72 CreateImeWindow(expected_bounds, true); | 72 CreateImeWindow(expected_bounds, true); |
73 VerifyImeWindow(expected_bounds); | 73 VerifyImeWindow(expected_bounds); |
74 } | 74 } |
75 | 75 |
76 IN_PROC_BROWSER_TEST_F(ImeWindowBrowserTest, FollowCursor) { | 76 IN_PROC_BROWSER_TEST_F(ImeWindowBrowserTest, FollowCursor) { |
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(50, 50, 1, 10)); | 79 ime_window_->FollowCursor(gfx::Rect(50, 50, 1, 10)); |
80 expected_bounds.set_x(18); // cursor left - titlebar width(32). | 80 expected_bounds.set_x(18); // cursor left - titlebar width(32). |
81 expected_bounds.set_y(63); // cursor top + cursor height + margin(3). | 81 expected_bounds.set_y(63); // 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 |