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 <deque> | 9 #include <deque> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 13 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
14 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 14 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
15 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" | 15 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" |
16 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
17 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 16 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
18 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er_brlapi.h" | 17 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er_brlapi.h" |
19 #include "chrome/browser/extensions/api/braille_display_private/braille_display_
private_api.h" | 18 #include "chrome/browser/extensions/api/braille_display_private/braille_display_
private_api.h" |
20 #include "chrome/browser/extensions/api/braille_display_private/brlapi_connectio
n.h" | 19 #include "chrome/browser/extensions/api/braille_display_private/brlapi_connectio
n.h" |
21 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con
troller.h" | 20 #include "chrome/browser/extensions/api/braille_display_private/stub_braille_con
troller.h" |
22 #include "chrome/browser/extensions/extension_apitest.h" | 21 #include "chrome/browser/extensions/extension_apitest.h" |
23 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
24 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
25 #include "chromeos/chromeos_switches.h" | 24 #include "chromeos/chromeos_switches.h" |
| 25 #include "components/user_manager/user_manager.h" |
26 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
28 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
30 | 30 |
31 using chromeos::ProfileHelper; | 31 using chromeos::ProfileHelper; |
32 using chromeos::ScreenLocker; | 32 using chromeos::ScreenLocker; |
33 using chromeos::UserManager; | 33 using user_manager::UserManager; |
34 using chromeos::test::ScreenLockerTester; | 34 using chromeos::test::ScreenLockerTester; |
35 using content::BrowserThread; | 35 using content::BrowserThread; |
36 | 36 |
37 namespace extensions { | 37 namespace extensions { |
38 namespace api { | 38 namespace api { |
39 namespace braille_display_private { | 39 namespace braille_display_private { |
40 | 40 |
41 namespace { | 41 namespace { |
42 | 42 |
43 const char kTestUserName[] = "owner@invalid.domain"; | 43 const char kTestUserName[] = "owner@invalid.domain"; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 protected: | 320 protected: |
321 virtual void DisableAccessibilityManagerBraille() OVERRIDE { | 321 virtual void DisableAccessibilityManagerBraille() OVERRIDE { |
322 // Let the accessibility manager behave as usual for these tests. | 322 // Let the accessibility manager behave as usual for these tests. |
323 } | 323 } |
324 }; | 324 }; |
325 | 325 |
326 IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateAPIUserTest, | 326 IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateAPIUserTest, |
327 KeyEventOnLockScreen) { | 327 KeyEventOnLockScreen) { |
328 scoped_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester()); | 328 scoped_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester()); |
329 // Log in. | 329 // Log in. |
330 UserManager::Get()->UserLoggedIn(kTestUserName, kTestUserName, true); | 330 user_manager::UserManager::Get()->UserLoggedIn( |
331 UserManager::Get()->SessionStarted(); | 331 kTestUserName, kTestUserName, true); |
| 332 user_manager::UserManager::Get()->SessionStarted(); |
332 Profile* profile = ProfileManager::GetActiveUserProfile(); | 333 Profile* profile = ProfileManager::GetActiveUserProfile(); |
333 ASSERT_FALSE( | 334 ASSERT_FALSE( |
334 ProfileHelper::GetSigninProfile()->IsSameProfile(profile)) | 335 ProfileHelper::GetSigninProfile()->IsSameProfile(profile)) |
335 << ProfileHelper::GetSigninProfile()->GetDebugName() << " vs. " | 336 << ProfileHelper::GetSigninProfile()->GetDebugName() << " vs. " |
336 << profile->GetDebugName(); | 337 << profile->GetDebugName(); |
337 | 338 |
338 // Create API and event delegate for sign in profile. | 339 // Create API and event delegate for sign in profile. |
339 BrailleDisplayPrivateAPI signin_api(ProfileHelper::GetSigninProfile()); | 340 BrailleDisplayPrivateAPI signin_api(ProfileHelper::GetSigninProfile()); |
340 MockEventDelegate* signin_delegate = SetMockEventDelegate(&signin_api); | 341 MockEventDelegate* signin_delegate = SetMockEventDelegate(&signin_api); |
341 EXPECT_EQ(0, signin_delegate->GetEventCount()); | 342 EXPECT_EQ(0, signin_delegate->GetEventCount()); |
(...skipping 21 matching lines...) Expand all Loading... |
363 DismissLockScreen(tester.get()); | 364 DismissLockScreen(tester.get()); |
364 signin_api.OnBrailleKeyEvent(key_event); | 365 signin_api.OnBrailleKeyEvent(key_event); |
365 user_api.OnBrailleKeyEvent(key_event); | 366 user_api.OnBrailleKeyEvent(key_event); |
366 EXPECT_EQ(1, signin_delegate->GetEventCount()); | 367 EXPECT_EQ(1, signin_delegate->GetEventCount()); |
367 EXPECT_EQ(2, user_delegate->GetEventCount()); | 368 EXPECT_EQ(2, user_delegate->GetEventCount()); |
368 } | 369 } |
369 | 370 |
370 } // namespace braille_display_private | 371 } // namespace braille_display_private |
371 } // namespace api | 372 } // namespace api |
372 } // namespace extensions | 373 } // namespace extensions |
OLD | NEW |