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 "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" | 6 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/signin/signin_manager_factory.h" | 8 #include "chrome/browser/signin/signin_manager_factory.h" |
9 #include "components/signin/core/browser/signin_manager.h" | 9 #include "components/signin/core/browser/signin_manager.h" |
10 #include "components/signin/core/common/profile_management_switches.h" | 10 #include "components/signin/core/common/profile_management_switches.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 ExtensionApiTest::RunTestOnMainThreadLoop(); | 57 ExtensionApiTest::RunTestOnMainThreadLoop(); |
58 registrar_.RemoveAll(); | 58 registrar_.RemoveAll(); |
59 } | 59 } |
60 | 60 |
61 // content::NotificationObserver override: | 61 // content::NotificationObserver override: |
62 virtual void Observe(int type, | 62 virtual void Observe(int type, |
63 const content::NotificationSource& source, | 63 const content::NotificationSource& source, |
64 const content::NotificationDetails& details) OVERRIDE { | 64 const content::NotificationDetails& details) OVERRIDE { |
65 const std::string& content = *content::Details<std::string>(details).ptr(); | 65 const std::string& content = *content::Details<std::string>(details).ptr(); |
66 if (content == kAttemptClickAuthMessage) { | 66 if (content == kAttemptClickAuthMessage) { |
67 ScreenlockBridge::Get()->lock_handler()->SetAuthType( | 67 SigninScreenBridge::Get()->lock_handler()->SetAuthType( |
68 kTestUser, | 68 kTestUser, |
69 ScreenlockBridge::LockHandler::USER_CLICK, | 69 SigninScreenBridge::LockHandler::USER_CLICK, |
70 base::string16()); | 70 base::string16()); |
71 extensions::ScreenlockPrivateEventRouter* router = | 71 extensions::ScreenlockPrivateEventRouter* router = |
72 extensions::ScreenlockPrivateEventRouter::GetFactoryInstance()->Get( | 72 extensions::ScreenlockPrivateEventRouter::GetFactoryInstance()->Get( |
73 profile()); | 73 profile()); |
74 router->OnAuthAttempted( | 74 router->OnAuthAttempted( |
75 ScreenlockBridge::Get()->lock_handler()->GetAuthType(kTestUser), ""); | 75 SigninScreenBridge::Get()->lock_handler()->GetAuthType(kTestUser), |
| 76 ""); |
76 } | 77 } |
77 } | 78 } |
78 | 79 |
79 // Loads |extension_name| as appropriate for the platform and waits for a | 80 // Loads |extension_name| as appropriate for the platform and waits for a |
80 // pass / fail notification. | 81 // pass / fail notification. |
81 void RunTest(const std::string& extension_name) { | 82 void RunTest(const std::string& extension_name) { |
82 #if defined(OS_CHROMEOS) | 83 #if defined(OS_CHROMEOS) |
83 ASSERT_TRUE(RunComponentExtensionTest(extension_name)) << message_; | 84 ASSERT_TRUE(RunComponentExtensionTest(extension_name)) << message_; |
84 #else | 85 #else |
85 ASSERT_TRUE(RunExtensionTest(extension_name)) << message_; | 86 ASSERT_TRUE(RunExtensionTest(extension_name)) << message_; |
86 #endif | 87 #endif |
87 } | 88 } |
88 | 89 |
89 private: | 90 private: |
90 content::NotificationRegistrar registrar_; | 91 content::NotificationRegistrar registrar_; |
91 | 92 |
92 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateApiTest); | 93 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateApiTest); |
93 }; | 94 }; |
94 | 95 |
95 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, LockUnlock) { | 96 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, LockUnlock) { |
96 RunTest("screenlock_private/lock_unlock"); | 97 RunTest("screenlock_private/lock_unlock"); |
97 } | 98 } |
98 | 99 |
99 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) { | 100 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) { |
100 RunTest("screenlock_private/auth_type"); | 101 RunTest("screenlock_private/auth_type"); |
101 } | 102 } |
102 | 103 |
103 } // namespace extensions | 104 } // namespace extensions |
OLD | NEW |