| 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/accelerators/accelerator_controller.h" | 7 #include "ash/common/accelerators/accelerator_controller.h" |
| 8 #include "ash/common/accessibility_delegate.h" | 8 #include "ash/common/accessibility_delegate.h" |
| 9 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" | 9 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" |
| 10 #include "ash/common/system/status_area_widget.h" | 10 #include "ash/common/system/status_area_widget.h" |
| 11 #include "ash/common/system/tray/ime_info.h" | 11 #include "ash/common/system/tray/ime_info.h" |
| 12 #include "ash/common/system/tray/system_tray_notifier.h" | 12 #include "ash/common/system/tray/system_tray_notifier.h" |
| 13 #include "ash/common/test/test_system_tray_delegate.h" | 13 #include "ash/common/test/test_system_tray_delegate.h" |
| 14 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 15 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
| 16 #include "ash/test/status_area_widget_test_helper.h" | 16 #include "ash/test/status_area_widget_test_helper.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "ui/accessibility/ax_view_state.h" | 18 #include "ui/accessibility/ax_node_data.h" |
| 19 #include "ui/events/event.h" | 19 #include "ui/events/event.h" |
| 20 #include "ui/views/controls/label.h" | 20 #include "ui/views/controls/label.h" |
| 21 | 21 |
| 22 using base::UTF8ToUTF16; | 22 using base::UTF8ToUTF16; |
| 23 | 23 |
| 24 namespace ash { | 24 namespace ash { |
| 25 | 25 |
| 26 ImeMenuTray* GetTray() { | 26 ImeMenuTray* GetTray() { |
| 27 return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->ime_menu_tray(); | 27 return StatusAreaWidgetTestHelper::GetStatusAreaWidget()->ime_menu_tray(); |
| 28 } | 28 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 expected_ime_ids.push_back(ime.id); | 60 expected_ime_ids.push_back(ime.id); |
| 61 } | 61 } |
| 62 for (const auto& ime : ime_map) { | 62 for (const auto& ime : ime_map) { |
| 63 // Tests that all the IMEs on the view is in the list of selected IMEs. | 63 // Tests that all the IMEs on the view is in the list of selected IMEs. |
| 64 if (std::find(expected_ime_ids.begin(), expected_ime_ids.end(), | 64 if (std::find(expected_ime_ids.begin(), expected_ime_ids.end(), |
| 65 ime.second) == expected_ime_ids.end()) { | 65 ime.second) == expected_ime_ids.end()) { |
| 66 return false; | 66 return false; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Tests that the checked IME is the current IME. | 69 // Tests that the checked IME is the current IME. |
| 70 ui::AXViewState state; | 70 ui::AXNodeData node_data; |
| 71 ime.first->GetAccessibleState(&state); | 71 node_data.state = 0; |
| 72 if (state.HasStateFlag(ui::AX_STATE_CHECKED)) { | 72 ime.first->GetAccessibleNodeData(&node_data); |
| 73 if (node_data.HasStateFlag(ui::AX_STATE_CHECKED)) { |
| 73 if (ime.second != expected_current_ime.id) | 74 if (ime.second != expected_current_ime.id) |
| 74 return false; | 75 return false; |
| 75 } | 76 } |
| 76 } | 77 } |
| 77 return true; | 78 return true; |
| 78 } | 79 } |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 DISALLOW_COPY_AND_ASSIGN(ImeMenuTrayTest); | 82 DISALLOW_COPY_AND_ASSIGN(ImeMenuTrayTest); |
| 82 }; | 83 }; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // The virtual keyboard should be enabled. | 277 // The virtual keyboard should be enabled. |
| 277 EXPECT_TRUE(accessibility_delegate->IsVirtualKeyboardEnabled()); | 278 EXPECT_TRUE(accessibility_delegate->IsVirtualKeyboardEnabled()); |
| 278 | 279 |
| 279 // Hides the keyboard. | 280 // Hides the keyboard. |
| 280 GetTray()->OnKeyboardHidden(); | 281 GetTray()->OnKeyboardHidden(); |
| 281 // The keyboard should still be disabled. | 282 // The keyboard should still be disabled. |
| 282 EXPECT_FALSE(accessibility_delegate->IsVirtualKeyboardEnabled()); | 283 EXPECT_FALSE(accessibility_delegate->IsVirtualKeyboardEnabled()); |
| 283 } | 284 } |
| 284 | 285 |
| 285 } // namespace ash | 286 } // namespace ash |
| OLD | NEW |