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 "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" | 5 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" |
6 | 6 |
7 #include "ash/common/system/status_area_widget.h" | 7 #include "ash/common/system/status_area_widget.h" |
8 #include "ash/common/system/tray/ime_info.h" | 8 #include "ash/common/system/tray/ime_info.h" |
9 #include "ash/common/system/tray/system_tray_notifier.h" | 9 #include "ash/common/system/tray/system_tray_notifier.h" |
10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 | 35 |
36 // Returns the label text of the tray. | 36 // Returns the label text of the tray. |
37 const base::string16& GetTrayText() { return GetTray()->label_->text(); } | 37 const base::string16& GetTrayText() { return GetTray()->label_->text(); } |
38 | 38 |
39 // Returns true if the background color of the tray is active. | 39 // Returns true if the background color of the tray is active. |
40 bool IsTrayBackgroundActive() { | 40 bool IsTrayBackgroundActive() { |
41 return GetTray()->draw_background_as_active(); | 41 return GetTray()->draw_background_as_active(); |
42 } | 42 } |
43 | 43 |
44 // Returns true if the IME menu bubble has been shown. | 44 // Returns true if the IME menu bubble has been shown. |
45 bool IsBubbleShown() { | 45 bool IsBubbleShown() { return (GetTray()->IsBubbleShownForTesting()); } |
James Cook
2016/08/23 16:38:33
nit: no ()
Azure Wei
2016/08/24 05:22:43
Done.
| |
46 return (GetTray()->bubble_ && GetTray()->bubble_->bubble_view()); | |
47 } | |
48 | 46 |
49 private: | 47 private: |
50 DISALLOW_COPY_AND_ASSIGN(ImeMenuTrayTest); | 48 DISALLOW_COPY_AND_ASSIGN(ImeMenuTrayTest); |
51 }; | 49 }; |
52 | 50 |
53 // Tests that visibility of IME menu tray should be consistent with the | 51 // Tests that visibility of IME menu tray should be consistent with the |
54 // activation of the IME menu. | 52 // activation of the IME menu. |
55 TEST_F(ImeMenuTrayTest, ImeMenuTrayVisibility) { | 53 TEST_F(ImeMenuTrayTest, ImeMenuTrayVisibility) { |
James Cook
2016/08/23 16:38:33
Please add a test for the IME menu refreshing.
Azure Wei
2016/08/24 05:22:43
Added test: RefreshImeWithListViewCreated.
| |
56 ASSERT_FALSE(IsVisible()); | 54 ASSERT_FALSE(IsVisible()); |
57 | 55 |
58 WmShell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true); | 56 WmShell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true); |
59 EXPECT_TRUE(IsVisible()); | 57 EXPECT_TRUE(IsVisible()); |
60 | 58 |
61 WmShell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(false); | 59 WmShell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(false); |
62 EXPECT_FALSE(IsVisible()); | 60 EXPECT_FALSE(IsVisible()); |
63 } | 61 } |
64 | 62 |
65 // Tests that IME menu tray shows the right info of the current IME. | 63 // Tests that IME menu tray shows the right info of the current IME. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 // element will be deactivated. | 112 // element will be deactivated. |
115 GetTray()->PerformAction(tap); | 113 GetTray()->PerformAction(tap); |
116 EXPECT_TRUE(IsTrayBackgroundActive()); | 114 EXPECT_TRUE(IsTrayBackgroundActive()); |
117 WmShell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(false); | 115 WmShell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(false); |
118 EXPECT_FALSE(IsVisible()); | 116 EXPECT_FALSE(IsVisible()); |
119 EXPECT_FALSE(IsBubbleShown()); | 117 EXPECT_FALSE(IsBubbleShown()); |
120 EXPECT_FALSE(IsTrayBackgroundActive()); | 118 EXPECT_FALSE(IsTrayBackgroundActive()); |
121 } | 119 } |
122 | 120 |
123 } // namespace ash | 121 } // namespace ash |
OLD | NEW |