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 "base/strings/string16.h" | 5 #include "base/strings/string16.h" |
| 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/browser_process.h" |
6 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" | 8 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 10 #include "chrome/browser/profiles/profile_info_cache.h" |
| 11 #include "chrome/browser/profiles/profile_manager.h" |
8 #include "chrome/browser/signin/easy_unlock_service.h" | 12 #include "chrome/browser/signin/easy_unlock_service.h" |
9 #include "chrome/browser/signin/signin_manager_factory.h" | 13 #include "chrome/browser/signin/signin_manager_factory.h" |
10 #include "components/signin/core/browser/signin_manager.h" | 14 #include "components/signin/core/browser/signin_manager.h" |
11 #include "components/signin/core/common/profile_management_switches.h" | 15 #include "components/signin/core/common/profile_management_switches.h" |
12 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
13 #include "extensions/browser/api/test/test_api.h" | 17 #include "extensions/browser/api/test/test_api.h" |
14 #include "extensions/browser/notification_types.h" | 18 #include "extensions/browser/notification_types.h" |
15 #include "extensions/common/switches.h" | 19 #include "extensions/common/switches.h" |
16 | 20 |
17 namespace extensions { | 21 namespace extensions { |
(...skipping 21 matching lines...) Expand all Loading... |
39 | 43 |
40 #if !defined(OS_CHROMEOS) | 44 #if !defined(OS_CHROMEOS) |
41 // New profile management needs to be on for non-ChromeOS lock. | 45 // New profile management needs to be on for non-ChromeOS lock. |
42 ::switches::EnableNewProfileManagementForTesting(command_line); | 46 ::switches::EnableNewProfileManagementForTesting(command_line); |
43 #endif | 47 #endif |
44 } | 48 } |
45 | 49 |
46 void SetUpOnMainThread() override { | 50 void SetUpOnMainThread() override { |
47 SigninManagerFactory::GetForProfile(profile()) | 51 SigninManagerFactory::GetForProfile(profile()) |
48 ->SetAuthenticatedUsername(kTestUser); | 52 ->SetAuthenticatedUsername(kTestUser); |
| 53 ProfileInfoCache& info_cache = |
| 54 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 55 size_t index = info_cache.GetIndexOfProfileWithPath(profile()->GetPath()); |
| 56 ASSERT_NE(std::string::npos, index); |
| 57 info_cache.SetUserNameOfProfileAtIndex(index, base::UTF8ToUTF16(kTestUser)); |
49 ExtensionApiTest::SetUpOnMainThread(); | 58 ExtensionApiTest::SetUpOnMainThread(); |
50 } | 59 } |
51 | 60 |
52 protected: | 61 protected: |
53 // ExtensionApiTest override: | 62 // ExtensionApiTest override: |
54 void RunTestOnMainThreadLoop() override { | 63 void RunTestOnMainThreadLoop() override { |
55 registrar_.Add(this, | 64 registrar_.Add(this, |
56 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, | 65 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, |
57 content::NotificationService::AllSources()); | 66 content::NotificationService::AllSources()); |
58 ExtensionApiTest::RunTestOnMainThreadLoop(); | 67 ExtensionApiTest::RunTestOnMainThreadLoop(); |
(...skipping 27 matching lines...) Expand all Loading... |
86 | 95 |
87 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, LockUnlock) { | 96 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, LockUnlock) { |
88 RunTest("screenlock_private/lock_unlock"); | 97 RunTest("screenlock_private/lock_unlock"); |
89 } | 98 } |
90 | 99 |
91 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) { | 100 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) { |
92 RunTest("screenlock_private/auth_type"); | 101 RunTest("screenlock_private/auth_type"); |
93 } | 102 } |
94 | 103 |
95 } // namespace extensions | 104 } // namespace extensions |
OLD | NEW |