| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "ash/common/shell_delegate.h" | 7 #include "ash/common/shell_delegate.h" |
| 8 #include "ash/common/system/tray/system_tray.h" | 8 #include "ash/common/system/tray/system_tray.h" |
| 9 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
| 10 #include "ash/common/system/user/tray_user.h" | 10 #include "ash/common/system/user/tray_user.h" |
| 11 #include "ash/common/system/user/tray_user_separator.h" | 11 #include "ash/common/system/user/tray_user_separator.h" |
| 12 #include "ash/common/system/user/user_view.h" | 12 #include "ash/common/system/user/user_view.h" |
| 13 #include "ash/common/test/test_session_state_delegate.h" | 13 #include "ash/common/test/test_session_state_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/ash_test_helper.h" | 16 #include "ash/test/ash_test_helper.h" |
| 17 #include "ash/test/test_shell_delegate.h" | 17 #include "ash/test/test_shell_delegate.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "components/signin/core/account_id/account_id.h" | 19 #include "components/signin/core/account_id/account_id.h" |
| 20 #include "components/user_manager/user_info.h" | 20 #include "components/user_manager/user_info.h" |
| 21 #include "ui/accessibility/ax_view_state.h" | 21 #include "ui/accessibility/ax_node_data.h" |
| 22 #include "ui/events/test/event_generator.h" | 22 #include "ui/events/test/event_generator.h" |
| 23 #include "ui/gfx/animation/animation_container_element.h" | 23 #include "ui/gfx/animation/animation_container_element.h" |
| 24 #include "ui/views/view.h" | 24 #include "ui/views/view.h" |
| 25 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
| 26 | 26 |
| 27 namespace ash { | 27 namespace ash { |
| 28 | 28 |
| 29 class TrayUserTest : public test::AshTestBase { | 29 class TrayUserTest : public test::AshTestBase { |
| 30 public: | 30 public: |
| 31 TrayUserTest() = default; | 31 TrayUserTest() = default; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 tray()->CloseSystemBubble(); | 150 tray()->CloseSystemBubble(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 TEST_F(TrayUserTest, AccessibleLabelContainsSingleUserInfo) { | 153 TEST_F(TrayUserTest, AccessibleLabelContainsSingleUserInfo) { |
| 154 InitializeParameters(1, false); | 154 InitializeParameters(1, false); |
| 155 ui::test::EventGenerator& generator = GetEventGenerator(); | 155 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 156 ShowTrayMenu(&generator); | 156 ShowTrayMenu(&generator); |
| 157 | 157 |
| 158 views::View* view = | 158 views::View* view = |
| 159 tray_user(0)->user_view_for_test()->user_card_view_for_test(); | 159 tray_user(0)->user_view_for_test()->user_card_view_for_test(); |
| 160 ui::AXViewState state; | 160 ui::AXNodeData node_data; |
| 161 view->GetAccessibleState(&state); | 161 view->GetAccessibleNodeData(&node_data); |
| 162 EXPECT_EQ( | 162 EXPECT_EQ( |
| 163 base::UTF8ToUTF16("Über tray Über tray Über tray Über tray First@tray"), | 163 base::UTF8ToUTF16("Über tray Über tray Über tray Über tray First@tray"), |
| 164 state.name); | 164 node_data.GetString16Attribute(ui::AX_ATTR_NAME)); |
| 165 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, state.role); | 165 EXPECT_EQ(ui::AX_ROLE_STATIC_TEXT, node_data.role); |
| 166 } | 166 } |
| 167 | 167 |
| 168 TEST_F(TrayUserTest, AccessibleLabelContainsMultiUserInfo) { | 168 TEST_F(TrayUserTest, AccessibleLabelContainsMultiUserInfo) { |
| 169 InitializeParameters(1, true); | 169 InitializeParameters(1, true); |
| 170 ui::test::EventGenerator& generator = GetEventGenerator(); | 170 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 171 ShowTrayMenu(&generator); | 171 ShowTrayMenu(&generator); |
| 172 | 172 |
| 173 views::View* view = | 173 views::View* view = |
| 174 tray_user(0)->user_view_for_test()->user_card_view_for_test(); | 174 tray_user(0)->user_view_for_test()->user_card_view_for_test(); |
| 175 ui::AXViewState state; | 175 ui::AXNodeData node_data; |
| 176 view->GetAccessibleState(&state); | 176 view->GetAccessibleNodeData(&node_data); |
| 177 EXPECT_EQ( | 177 EXPECT_EQ( |
| 178 base::UTF8ToUTF16("Über tray Über tray Über tray Über tray First@tray"), | 178 base::UTF8ToUTF16("Über tray Über tray Über tray Über tray First@tray"), |
| 179 state.name); | 179 node_data.GetString16Attribute(ui::AX_ATTR_NAME)); |
| 180 EXPECT_EQ(ui::AX_ROLE_BUTTON, state.role); | 180 EXPECT_EQ(ui::AX_ROLE_BUTTON, node_data.role); |
| 181 } | 181 } |
| 182 | 182 |
| 183 #if defined(OS_CHROMEOS) | 183 #if defined(OS_CHROMEOS) |
| 184 // Make sure that in multi user mode the user panel can be activated and there | 184 // Make sure that in multi user mode the user panel can be activated and there |
| 185 // will be one panel for each user plus one additional separator at the end. | 185 // will be one panel for each user plus one additional separator at the end. |
| 186 // Note: the mouse watcher (for automatic closing upon leave) cannot be tested | 186 // Note: the mouse watcher (for automatic closing upon leave) cannot be tested |
| 187 // here since it does not work with the event system in unit tests. | 187 // here since it does not work with the event system in unit tests. |
| 188 TEST_F(TrayUserTest, MultiUserModeDoesNotAllowToAddUser) { | 188 TEST_F(TrayUserTest, MultiUserModeDoesNotAllowToAddUser) { |
| 189 InitializeParameters(1, true); | 189 InitializeParameters(1, true); |
| 190 | 190 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // Since the name is capitalized, the email should be different than the | 260 // Since the name is capitalized, the email should be different than the |
| 261 // user_id. | 261 // user_id. |
| 262 EXPECT_NE(active_user->GetAccountId().GetUserEmail(), | 262 EXPECT_NE(active_user->GetAccountId().GetUserEmail(), |
| 263 second_user->GetDisplayEmail()); | 263 second_user->GetDisplayEmail()); |
| 264 tray()->CloseSystemBubble(); | 264 tray()->CloseSystemBubble(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 #endif | 267 #endif |
| 268 | 268 |
| 269 } // namespace ash | 269 } // namespace ash |
| OLD | NEW |