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