| 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/user_manager/user_manager.h" | 28 #include "components/user_manager/user_manager.h" |
| 28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| 29 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
| 30 #include "content/public/test/test_utils.h" | 31 #include "content/public/test/test_utils.h" |
| 31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 32 | 33 |
| 33 using chromeos::ProfileHelper; | 34 using chromeos::ProfileHelper; |
| 34 using chromeos::ScreenLocker; | 35 using chromeos::ScreenLocker; |
| 35 using user_manager::UserManager; | 36 using user_manager::UserManager; |
| 36 using chromeos::test::ScreenLockerTester; | 37 using chromeos::test::ScreenLockerTester; |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 #define MAYBE_KeyEventOnLockScreen DISABLED_KeyEventOnLockScreen | 326 #define MAYBE_KeyEventOnLockScreen DISABLED_KeyEventOnLockScreen |
| 326 #else | 327 #else |
| 327 #define MAYBE_KeyEventOnLockScreen KeyEventOnLockScreen | 328 #define MAYBE_KeyEventOnLockScreen KeyEventOnLockScreen |
| 328 #endif | 329 #endif |
| 329 IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateAPIUserTest, | 330 IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateAPIUserTest, |
| 330 MAYBE_KeyEventOnLockScreen) { | 331 MAYBE_KeyEventOnLockScreen) { |
| 331 std::unique_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester()); | 332 std::unique_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester()); |
| 332 // Log in. | 333 // Log in. |
| 333 user_manager::UserManager::Get()->UserLoggedIn( | 334 user_manager::UserManager::Get()->UserLoggedIn( |
| 334 AccountId::FromUserEmail(kTestUserName), kTestUserName, true); | 335 AccountId::FromUserEmail(kTestUserName), kTestUserName, true); |
| 335 user_manager::UserManager::Get()->SessionStarted(); | 336 session_manager::SessionManager::Get()->SessionStarted(); |
| 336 Profile* profile = ProfileManager::GetActiveUserProfile(); | 337 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 337 ASSERT_FALSE( | 338 ASSERT_FALSE( |
| 338 ProfileHelper::GetSigninProfile()->IsSameProfile(profile)) | 339 ProfileHelper::GetSigninProfile()->IsSameProfile(profile)) |
| 339 << ProfileHelper::GetSigninProfile()->GetDebugName() << " vs. " | 340 << ProfileHelper::GetSigninProfile()->GetDebugName() << " vs. " |
| 340 << profile->GetDebugName(); | 341 << profile->GetDebugName(); |
| 341 | 342 |
| 342 // Create API and event delegate for sign in profile. | 343 // Create API and event delegate for sign in profile. |
| 343 BrailleDisplayPrivateAPI signin_api(ProfileHelper::GetSigninProfile()); | 344 BrailleDisplayPrivateAPI signin_api(ProfileHelper::GetSigninProfile()); |
| 344 MockEventDelegate* signin_delegate = SetMockEventDelegate(&signin_api); | 345 MockEventDelegate* signin_delegate = SetMockEventDelegate(&signin_api); |
| 345 EXPECT_EQ(0, signin_delegate->GetEventCount()); | 346 EXPECT_EQ(0, signin_delegate->GetEventCount()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 367 DismissLockScreen(tester.get()); | 368 DismissLockScreen(tester.get()); |
| 368 signin_api.OnBrailleKeyEvent(key_event); | 369 signin_api.OnBrailleKeyEvent(key_event); |
| 369 user_api.OnBrailleKeyEvent(key_event); | 370 user_api.OnBrailleKeyEvent(key_event); |
| 370 EXPECT_EQ(1, signin_delegate->GetEventCount()); | 371 EXPECT_EQ(1, signin_delegate->GetEventCount()); |
| 371 EXPECT_EQ(2, user_delegate->GetEventCount()); | 372 EXPECT_EQ(2, user_delegate->GetEventCount()); |
| 372 } | 373 } |
| 373 | 374 |
| 374 } // namespace braille_display_private | 375 } // namespace braille_display_private |
| 375 } // namespace api | 376 } // namespace api |
| 376 } // namespace extensions | 377 } // namespace extensions |
| OLD | NEW |