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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" | 12 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" |
13 #include "chrome/browser/extensions/extension_apitest.h" | 13 #include "chrome/browser/extensions/extension_apitest.h" |
14 #include "chrome/browser/profiles/profile_attributes_entry.h" | 14 #include "chrome/browser/profiles/profile_attributes_entry.h" |
15 #include "chrome/browser/profiles/profile_attributes_storage.h" | 15 #include "chrome/browser/profiles/profile_attributes_storage.h" |
16 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
17 #include "chrome/browser/signin/easy_unlock_service.h" | 17 #include "chrome/browser/signin/easy_unlock_service.h" |
18 #include "chrome/browser/signin/signin_manager_factory.h" | 18 #include "chrome/browser/signin/signin_manager_factory.h" |
19 #include "components/proximity_auth/screenlock_bridge.h" | 19 #include "components/proximity_auth/screenlock_bridge.h" |
20 #include "components/signin/core/browser/signin_manager.h" | 20 #include "components/signin/core/browser/signin_manager.h" |
21 #include "components/signin/core/common/profile_management_switches.h" | |
22 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
23 #include "extensions/browser/api/test/test_api.h" | 22 #include "extensions/browser/api/test/test_api.h" |
24 #include "extensions/browser/notification_types.h" | 23 #include "extensions/browser/notification_types.h" |
25 #include "extensions/common/switches.h" | 24 #include "extensions/common/switches.h" |
26 | 25 |
27 namespace extensions { | 26 namespace extensions { |
28 | 27 |
29 namespace { | 28 namespace { |
30 | 29 |
31 const char kTestGaiaId[] = "gaia-id-testuser@gmail.com"; | 30 const char kTestGaiaId[] = "gaia-id-testuser@gmail.com"; |
32 const char kAttemptClickAuthMessage[] = "attemptClickAuth"; | 31 const char kAttemptClickAuthMessage[] = "attemptClickAuth"; |
33 const char kTestExtensionId[] = "lkegkdgachcnekllcdfkijonogckdnjo"; | 32 const char kTestExtensionId[] = "lkegkdgachcnekllcdfkijonogckdnjo"; |
34 const char kTestUser[] = "testuser@gmail.com"; | 33 const char kTestUser[] = "testuser@gmail.com"; |
35 | 34 |
36 } // namespace | 35 } // namespace |
37 | 36 |
38 class ScreenlockPrivateApiTest : public ExtensionApiTest, | 37 class ScreenlockPrivateApiTest : public ExtensionApiTest, |
39 public content::NotificationObserver { | 38 public content::NotificationObserver { |
40 public: | 39 public: |
41 ScreenlockPrivateApiTest() {} | 40 ScreenlockPrivateApiTest() {} |
42 | 41 |
43 ~ScreenlockPrivateApiTest() override {} | 42 ~ScreenlockPrivateApiTest() override {} |
44 | 43 |
45 // ExtensionApiTest | 44 // ExtensionApiTest |
46 void SetUpCommandLine(base::CommandLine* command_line) override { | 45 void SetUpCommandLine(base::CommandLine* command_line) override { |
47 ExtensionApiTest::SetUpCommandLine(command_line); | 46 ExtensionApiTest::SetUpCommandLine(command_line); |
48 command_line->AppendSwitchASCII( | 47 command_line->AppendSwitchASCII( |
49 extensions::switches::kWhitelistedExtensionID, kTestExtensionId); | 48 extensions::switches::kWhitelistedExtensionID, kTestExtensionId); |
50 | 49 |
51 #if !defined(OS_CHROMEOS) | |
52 // New profile management needs to be on for non-ChromeOS lock. | |
53 ::switches::EnableNewProfileManagementForTesting(command_line); | |
54 #endif | |
55 } | 50 } |
56 | 51 |
57 void SetUpOnMainThread() override { | 52 void SetUpOnMainThread() override { |
58 SigninManagerFactory::GetForProfile(profile()) | 53 SigninManagerFactory::GetForProfile(profile()) |
59 ->SetAuthenticatedAccountInfo(kTestGaiaId, kTestUser); | 54 ->SetAuthenticatedAccountInfo(kTestGaiaId, kTestUser); |
60 ProfileAttributesEntry* entry; | 55 ProfileAttributesEntry* entry; |
61 ASSERT_TRUE(g_browser_process->profile_manager()-> | 56 ASSERT_TRUE(g_browser_process->profile_manager()-> |
62 GetProfileAttributesStorage(). | 57 GetProfileAttributesStorage(). |
63 GetProfileAttributesWithPath(profile()->GetPath(), &entry)); | 58 GetProfileAttributesWithPath(profile()->GetPath(), &entry)); |
64 entry->SetAuthInfo( | 59 entry->SetAuthInfo( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 RunTest("screenlock_private/lock_unlock"); | 113 RunTest("screenlock_private/lock_unlock"); |
119 } | 114 } |
120 | 115 |
121 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) { | 116 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) { |
122 RunTest("screenlock_private/auth_type"); | 117 RunTest("screenlock_private/auth_type"); |
123 } | 118 } |
124 | 119 |
125 #endif // defined(OS_CHROMEOS) | 120 #endif // defined(OS_CHROMEOS) |
126 | 121 |
127 } // namespace extensions | 122 } // namespace extensions |
OLD | NEW |