| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/accessibility_types.h" | 5 #include "ash/common/accessibility_types.h" |
| 6 #include "ash/common/login_status.h" | 6 #include "ash/common/login_status.h" |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.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_accessibility.h" | 9 #include "ash/common/system/tray_accessibility.h" |
| 10 #include "ash/common/test/test_session_state_delegate.h" | 10 #include "ash/common/test/test_session_state_delegate.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/test/base/in_process_browser_test.h" | 28 #include "chrome/test/base/in_process_browser_test.h" |
| 29 #include "chrome/test/base/testing_profile.h" | 29 #include "chrome/test/base/testing_profile.h" |
| 30 #include "chromeos/chromeos_switches.h" | 30 #include "chromeos/chromeos_switches.h" |
| 31 #include "components/policy/core/browser/browser_policy_connector.h" | 31 #include "components/policy/core/browser/browser_policy_connector.h" |
| 32 #include "components/policy/core/common/external_data_fetcher.h" | 32 #include "components/policy/core/common/external_data_fetcher.h" |
| 33 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 33 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
| 34 #include "components/policy/core/common/policy_map.h" | 34 #include "components/policy/core/common/policy_map.h" |
| 35 #include "components/policy/core/common/policy_types.h" | 35 #include "components/policy/core/common/policy_types.h" |
| 36 #include "components/policy/policy_constants.h" | 36 #include "components/policy/policy_constants.h" |
| 37 #include "components/prefs/pref_service.h" | 37 #include "components/prefs/pref_service.h" |
| 38 #include "components/session_manager/core/session_manager.h" |
| 38 #include "components/user_manager/user_manager.h" | 39 #include "components/user_manager/user_manager.h" |
| 39 #include "content/public/test/test_utils.h" | 40 #include "content/public/test/test_utils.h" |
| 40 #include "testing/gtest/include/gtest/gtest.h" | 41 #include "testing/gtest/include/gtest/gtest.h" |
| 41 #include "ui/views/controls/label.h" | 42 #include "ui/views/controls/label.h" |
| 42 #include "ui/views/widget/widget.h" | 43 #include "ui/views/widget/widget.h" |
| 43 | 44 |
| 44 using extensions::api::braille_display_private::BrailleObserver; | 45 using extensions::api::braille_display_private::BrailleObserver; |
| 45 using extensions::api::braille_display_private::DisplayState; | 46 using extensions::api::braille_display_private::DisplayState; |
| 46 using extensions::api::braille_display_private::MockBrailleController; | 47 using extensions::api::braille_display_private::MockBrailleController; |
| 47 using testing::Return; | 48 using testing::Return; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 policy::MockConfigurationPolicyProvider provider_; | 266 policy::MockConfigurationPolicyProvider provider_; |
| 266 MockBrailleController braille_controller_; | 267 MockBrailleController braille_controller_; |
| 267 }; | 268 }; |
| 268 | 269 |
| 269 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) { | 270 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, LoginStatus) { |
| 270 EXPECT_EQ(ash::LoginStatus::NOT_LOGGED_IN, GetLoginStatus()); | 271 EXPECT_EQ(ash::LoginStatus::NOT_LOGGED_IN, GetLoginStatus()); |
| 271 | 272 |
| 272 user_manager::UserManager::Get()->UserLoggedIn( | 273 user_manager::UserManager::Get()->UserLoggedIn( |
| 273 AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain", | 274 AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain", |
| 274 true); | 275 true); |
| 275 user_manager::UserManager::Get()->SessionStarted(); | 276 session_manager::SessionManager::Get()->SessionStarted(); |
| 276 | 277 |
| 277 EXPECT_EQ(ash::LoginStatus::USER, GetLoginStatus()); | 278 EXPECT_EQ(ash::LoginStatus::USER, GetLoginStatus()); |
| 278 } | 279 } |
| 279 | 280 |
| 280 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) { | 281 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowTrayIcon) { |
| 281 SetLoginStatus(ash::LoginStatus::NOT_LOGGED_IN); | 282 SetLoginStatus(ash::LoginStatus::NOT_LOGGED_IN); |
| 282 | 283 |
| 283 // Confirms that the icon is invisible before login. | 284 // Confirms that the icon is invisible before login. |
| 284 EXPECT_FALSE(IsTrayIconVisible()); | 285 EXPECT_FALSE(IsTrayIconVisible()); |
| 285 | 286 |
| 286 user_manager::UserManager::Get()->UserLoggedIn( | 287 user_manager::UserManager::Get()->UserLoggedIn( |
| 287 AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain", | 288 AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain", |
| 288 true); | 289 true); |
| 289 user_manager::UserManager::Get()->SessionStarted(); | 290 session_manager::SessionManager::Get()->SessionStarted(); |
| 290 | 291 |
| 291 // Confirms that the icon is invisible just after login. | 292 // Confirms that the icon is invisible just after login. |
| 292 EXPECT_FALSE(IsTrayIconVisible()); | 293 EXPECT_FALSE(IsTrayIconVisible()); |
| 293 | 294 |
| 294 // Toggling spoken feedback changes the visibillity of the icon. | 295 // Toggling spoken feedback changes the visibillity of the icon. |
| 295 AccessibilityManager::Get()->EnableSpokenFeedback( | 296 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 296 true, ash::A11Y_NOTIFICATION_NONE); | 297 true, ash::A11Y_NOTIFICATION_NONE); |
| 297 EXPECT_TRUE(IsTrayIconVisible()); | 298 EXPECT_TRUE(IsTrayIconVisible()); |
| 298 AccessibilityManager::Get()->EnableSpokenFeedback( | 299 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 299 false, ash::A11Y_NOTIFICATION_NONE); | 300 false, ash::A11Y_NOTIFICATION_NONE); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 EXPECT_TRUE(IsTrayIconVisible()); | 346 EXPECT_TRUE(IsTrayIconVisible()); |
| 346 AccessibilityManager::Get()->EnableHighContrast(false); | 347 AccessibilityManager::Get()->EnableHighContrast(false); |
| 347 EXPECT_FALSE(IsTrayIconVisible()); | 348 EXPECT_FALSE(IsTrayIconVisible()); |
| 348 } | 349 } |
| 349 | 350 |
| 350 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) { | 351 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenu) { |
| 351 // Login | 352 // Login |
| 352 user_manager::UserManager::Get()->UserLoggedIn( | 353 user_manager::UserManager::Get()->UserLoggedIn( |
| 353 AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain", | 354 AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain", |
| 354 true); | 355 true); |
| 355 user_manager::UserManager::Get()->SessionStarted(); | 356 session_manager::SessionManager::Get()->SessionStarted(); |
| 356 | 357 |
| 357 SetShowAccessibilityOptionsInSystemTrayMenu(false); | 358 SetShowAccessibilityOptionsInSystemTrayMenu(false); |
| 358 | 359 |
| 359 // Confirms that the menu is hidden. | 360 // Confirms that the menu is hidden. |
| 360 EXPECT_FALSE(CanCreateMenuItem()); | 361 EXPECT_FALSE(CanCreateMenuItem()); |
| 361 | 362 |
| 362 // Toggling spoken feedback changes the visibillity of the menu. | 363 // Toggling spoken feedback changes the visibillity of the menu. |
| 363 AccessibilityManager::Get()->EnableSpokenFeedback( | 364 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 364 true, ash::A11Y_NOTIFICATION_NONE); | 365 true, ash::A11Y_NOTIFICATION_NONE); |
| 365 EXPECT_TRUE(CanCreateMenuItem()); | 366 EXPECT_TRUE(CanCreateMenuItem()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 EXPECT_TRUE(CanCreateMenuItem()); | 415 EXPECT_TRUE(CanCreateMenuItem()); |
| 415 SetMagnifierEnabled(false); | 416 SetMagnifierEnabled(false); |
| 416 EXPECT_FALSE(CanCreateMenuItem()); | 417 EXPECT_FALSE(CanCreateMenuItem()); |
| 417 } | 418 } |
| 418 | 419 |
| 419 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { | 420 IN_PROC_BROWSER_TEST_P(TrayAccessibilityTest, ShowMenuWithShowMenuOption) { |
| 420 // Login | 421 // Login |
| 421 user_manager::UserManager::Get()->UserLoggedIn( | 422 user_manager::UserManager::Get()->UserLoggedIn( |
| 422 AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain", | 423 AccountId::FromUserEmail("owner@invalid.domain"), "owner@invalid.domain", |
| 423 true); | 424 true); |
| 424 user_manager::UserManager::Get()->SessionStarted(); | 425 session_manager::SessionManager::Get()->SessionStarted(); |
| 425 | 426 |
| 426 SetShowAccessibilityOptionsInSystemTrayMenu(true); | 427 SetShowAccessibilityOptionsInSystemTrayMenu(true); |
| 427 | 428 |
| 428 // Confirms that the menu is visible. | 429 // Confirms that the menu is visible. |
| 429 EXPECT_TRUE(CanCreateMenuItem()); | 430 EXPECT_TRUE(CanCreateMenuItem()); |
| 430 | 431 |
| 431 // The menu remains visible regardless of toggling spoken feedback. | 432 // The menu remains visible regardless of toggling spoken feedback. |
| 432 AccessibilityManager::Get()->EnableSpokenFeedback( | 433 AccessibilityManager::Get()->EnableSpokenFeedback( |
| 433 true, ash::A11Y_NOTIFICATION_NONE); | 434 true, ash::A11Y_NOTIFICATION_NONE); |
| 434 EXPECT_TRUE(CanCreateMenuItem()); | 435 EXPECT_TRUE(CanCreateMenuItem()); |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 EXPECT_FALSE(IsSettingsShownOnDetailMenu()); | 909 EXPECT_FALSE(IsSettingsShownOnDetailMenu()); |
| 909 CloseDetailMenu(); | 910 CloseDetailMenu(); |
| 910 } | 911 } |
| 911 | 912 |
| 912 INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance, | 913 INSTANTIATE_TEST_CASE_P(TrayAccessibilityTestInstance, |
| 913 TrayAccessibilityTest, | 914 TrayAccessibilityTest, |
| 914 testing::Values(PREF_SERVICE, | 915 testing::Values(PREF_SERVICE, |
| 915 POLICY)); | 916 POLICY)); |
| 916 | 917 |
| 917 } // namespace chromeos | 918 } // namespace chromeos |
| OLD | NEW |