| 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/tray/system_tray_notifier.h" | 7 #include "ash/common/system/tray/system_tray_notifier.h" |
| 8 #include "ash/common/system/view_observer.h" |
| 8 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/test/test_system_tray_delegate.h" | 11 #include "ash/test/test_system_tray_delegate.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 12 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
| 13 #include "ui/views/controls/label.h" | 14 #include "ui/views/controls/label.h" |
| 14 | 15 |
| 15 using base::UTF8ToUTF16; | 16 using base::UTF8ToUTF16; |
| 16 | 17 |
| 17 namespace ash { | 18 namespace ash { |
| 18 | 19 |
| 19 class ImeMenuTrayTest : public test::AshTestBase { | 20 class ImeMenuTrayTest : public test::AshTestBase { |
| 20 public: | 21 public: |
| 21 ImeMenuTrayTest() {} | 22 ImeMenuTrayTest() {} |
| 22 ~ImeMenuTrayTest() override {} | 23 ~ImeMenuTrayTest() override {} |
| 23 | 24 |
| 24 ImeMenuTray* ime_menu_tray() { return ime_menu_tray_.get(); } | 25 ImeMenuTray* ime_menu_tray() { return ime_menu_tray_.get(); } |
| 25 | 26 |
| 26 // test::AshTestBase: | 27 // test::AshTestBase: |
| 27 void SetUp() override { | 28 void SetUp() override { |
| 28 test::AshTestBase::SetUp(); | 29 test::AshTestBase::SetUp(); |
| 29 ime_menu_tray_.reset(new ImeMenuTray(GetPrimaryShelf())); | 30 ViewObserver* view_observer = new ViewObserver(); |
| 31 ime_menu_tray_.reset(new ImeMenuTray(GetPrimaryShelf(), view_observer)); |
| 30 } | 32 } |
| 31 | 33 |
| 32 void TearDown() override { | 34 void TearDown() override { |
| 33 ime_menu_tray_.reset(); | 35 ime_menu_tray_.reset(); |
| 34 test::AshTestBase::TearDown(); | 36 test::AshTestBase::TearDown(); |
| 35 } | 37 } |
| 36 | 38 |
| 37 protected: | 39 protected: |
| 38 // Returns true if the IME menu tray is visible. | 40 // Returns true if the IME menu tray is visible. |
| 39 bool IsVisible() { return ime_menu_tray_->visible(); } | 41 bool IsVisible() { return ime_menu_tray_->visible(); } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // If disabling the IME menu feature when the menu tray is activated, the tray | 115 // If disabling the IME menu feature when the menu tray is activated, the tray |
| 114 // element will be deactivated. | 116 // element will be deactivated. |
| 115 ime_menu_tray()->PerformAction(tap); | 117 ime_menu_tray()->PerformAction(tap); |
| 116 EXPECT_TRUE(IsTrayBackgroundActive()); | 118 EXPECT_TRUE(IsTrayBackgroundActive()); |
| 117 WmShell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(false); | 119 WmShell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(false); |
| 118 EXPECT_FALSE(IsVisible()); | 120 EXPECT_FALSE(IsVisible()); |
| 119 EXPECT_FALSE(IsTrayBackgroundActive()); | 121 EXPECT_FALSE(IsTrayBackgroundActive()); |
| 120 } | 122 } |
| 121 | 123 |
| 122 } // namespace ash | 124 } // namespace ash |
| OLD | NEW |