| 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 #ifndef USE_BRLAPI | 5 #ifndef USE_BRLAPI |
| 6 #error This test requires brlapi. | 6 #error This test requires brlapi. |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| 11 #include <deque> | 11 #include <deque> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 15 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 16 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 16 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 17 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" | 17 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" |
| 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 19 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er_brlapi.h" | 19 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er_brlapi.h" |
| 20 #include "chrome/browser/extensions/api/braille_display_private/braille_display_
private_api.h" | 20 #include "chrome/browser/extensions/api/braille_display_private/braille_display_
private_api.h" |
| 21 #include "chrome/browser/extensions/api/braille_display_private/brlapi_connectio
n.h" | 21 #include "chrome/browser/extensions/api/braille_display_private/brlapi_connectio
n.h" |
| 22 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con
troller.h" | 22 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con
troller.h" |
| 23 #include "chrome/browser/extensions/extension_apitest.h" | 23 #include "chrome/browser/extensions/extension_apitest.h" |
| 24 #include "chrome/browser/profiles/profile_manager.h" | 24 #include "chrome/browser/profiles/profile_manager.h" |
| 25 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
| 26 #include "chromeos/chromeos_switches.h" | 26 #include "chromeos/chromeos_switches.h" |
| 27 #include "components/session_manager/core/session_manager.h" | 27 #include "components/session_manager/core/session_manager.h" |
| 28 #include "components/user_manager/user_manager.h" | |
| 29 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 30 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
| 31 #include "content/public/test/test_utils.h" | 30 #include "content/public/test/test_utils.h" |
| 32 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
| 33 | 32 |
| 34 using chromeos::ProfileHelper; | 33 using chromeos::ProfileHelper; |
| 35 using chromeos::ScreenLocker; | 34 using chromeos::ScreenLocker; |
| 36 using user_manager::UserManager; | 35 using user_manager::UserManager; |
| 37 using chromeos::test::ScreenLockerTester; | 36 using chromeos::test::ScreenLockerTester; |
| 38 using content::BrowserThread; | 37 using content::BrowserThread; |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 // Flakily times out on ChromeOS MSAN bots. See https://crbug.com/592893. | 323 // Flakily times out on ChromeOS MSAN bots. See https://crbug.com/592893. |
| 325 #if defined(MEMORY_SANITIZER) | 324 #if defined(MEMORY_SANITIZER) |
| 326 #define MAYBE_KeyEventOnLockScreen DISABLED_KeyEventOnLockScreen | 325 #define MAYBE_KeyEventOnLockScreen DISABLED_KeyEventOnLockScreen |
| 327 #else | 326 #else |
| 328 #define MAYBE_KeyEventOnLockScreen KeyEventOnLockScreen | 327 #define MAYBE_KeyEventOnLockScreen KeyEventOnLockScreen |
| 329 #endif | 328 #endif |
| 330 IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateAPIUserTest, | 329 IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateAPIUserTest, |
| 331 MAYBE_KeyEventOnLockScreen) { | 330 MAYBE_KeyEventOnLockScreen) { |
| 332 std::unique_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester()); | 331 std::unique_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester()); |
| 333 // Log in. | 332 // Log in. |
| 334 user_manager::UserManager::Get()->UserLoggedIn( | 333 session_manager::SessionManager::Get()->CreateSession( |
| 335 AccountId::FromUserEmail(kTestUserName), kTestUserName, true); | 334 AccountId::FromUserEmail(kTestUserName), kTestUserName); |
| 336 session_manager::SessionManager::Get()->SessionStarted(); | 335 session_manager::SessionManager::Get()->SessionStarted(); |
| 337 Profile* profile = ProfileManager::GetActiveUserProfile(); | 336 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 338 ASSERT_FALSE( | 337 ASSERT_FALSE( |
| 339 ProfileHelper::GetSigninProfile()->IsSameProfile(profile)) | 338 ProfileHelper::GetSigninProfile()->IsSameProfile(profile)) |
| 340 << ProfileHelper::GetSigninProfile()->GetDebugName() << " vs. " | 339 << ProfileHelper::GetSigninProfile()->GetDebugName() << " vs. " |
| 341 << profile->GetDebugName(); | 340 << profile->GetDebugName(); |
| 342 | 341 |
| 343 // Create API and event delegate for sign in profile. | 342 // Create API and event delegate for sign in profile. |
| 344 BrailleDisplayPrivateAPI signin_api(ProfileHelper::GetSigninProfile()); | 343 BrailleDisplayPrivateAPI signin_api(ProfileHelper::GetSigninProfile()); |
| 345 MockEventDelegate* signin_delegate = SetMockEventDelegate(&signin_api); | 344 MockEventDelegate* signin_delegate = SetMockEventDelegate(&signin_api); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 368 DismissLockScreen(tester.get()); | 367 DismissLockScreen(tester.get()); |
| 369 signin_api.OnBrailleKeyEvent(key_event); | 368 signin_api.OnBrailleKeyEvent(key_event); |
| 370 user_api.OnBrailleKeyEvent(key_event); | 369 user_api.OnBrailleKeyEvent(key_event); |
| 371 EXPECT_EQ(1, signin_delegate->GetEventCount()); | 370 EXPECT_EQ(1, signin_delegate->GetEventCount()); |
| 372 EXPECT_EQ(2, user_delegate->GetEventCount()); | 371 EXPECT_EQ(2, user_delegate->GetEventCount()); |
| 373 } | 372 } |
| 374 | 373 |
| 375 } // namespace braille_display_private | 374 } // namespace braille_display_private |
| 376 } // namespace api | 375 } // namespace api |
| 377 } // namespace extensions | 376 } // namespace extensions |
| OLD | NEW |