| 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/easy_unlock_service.h" | 8 #include "chrome/browser/signin/easy_unlock_service.h" |
| 9 #include "chrome/browser/signin/signin_manager_factory.h" | 9 #include "chrome/browser/signin/signin_manager_factory.h" |
| 10 #include "components/signin/core/browser/signin_manager.h" | 10 #include "components/signin/core/browser/signin_manager.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 class ScreenlockPrivateApiTest : public ExtensionApiTest, | 27 class ScreenlockPrivateApiTest : public ExtensionApiTest, |
| 28 public content::NotificationObserver { | 28 public content::NotificationObserver { |
| 29 public: | 29 public: |
| 30 ScreenlockPrivateApiTest() {} | 30 ScreenlockPrivateApiTest() {} |
| 31 | 31 |
| 32 virtual ~ScreenlockPrivateApiTest() {} | 32 virtual ~ScreenlockPrivateApiTest() {} |
| 33 | 33 |
| 34 // ExtensionApiTest | 34 // ExtensionApiTest |
| 35 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 35 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 36 ExtensionApiTest::SetUpCommandLine(command_line); | 36 ExtensionApiTest::SetUpCommandLine(command_line); |
| 37 command_line->AppendSwitchASCII( | 37 command_line->AppendSwitchASCII( |
| 38 extensions::switches::kWhitelistedExtensionID, kTestExtensionId); | 38 extensions::switches::kWhitelistedExtensionID, kTestExtensionId); |
| 39 | 39 |
| 40 #if !defined(OS_CHROMEOS) | 40 #if !defined(OS_CHROMEOS) |
| 41 // New profile management needs to be on for non-ChromeOS lock. | 41 // New profile management needs to be on for non-ChromeOS lock. |
| 42 ::switches::EnableNewProfileManagementForTesting(command_line); | 42 ::switches::EnableNewProfileManagementForTesting(command_line); |
| 43 #endif | 43 #endif |
| 44 } | 44 } |
| 45 | 45 |
| 46 virtual void SetUpOnMainThread() OVERRIDE { | 46 virtual void SetUpOnMainThread() override { |
| 47 SigninManagerFactory::GetForProfile(profile()) | 47 SigninManagerFactory::GetForProfile(profile()) |
| 48 ->SetAuthenticatedUsername(kTestUser); | 48 ->SetAuthenticatedUsername(kTestUser); |
| 49 ExtensionApiTest::SetUpOnMainThread(); | 49 ExtensionApiTest::SetUpOnMainThread(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 // ExtensionApiTest override: | 53 // ExtensionApiTest override: |
| 54 virtual void RunTestOnMainThreadLoop() OVERRIDE { | 54 virtual void RunTestOnMainThreadLoop() override { |
| 55 registrar_.Add(this, | 55 registrar_.Add(this, |
| 56 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, | 56 extensions::NOTIFICATION_EXTENSION_TEST_MESSAGE, |
| 57 content::NotificationService::AllSources()); | 57 content::NotificationService::AllSources()); |
| 58 ExtensionApiTest::RunTestOnMainThreadLoop(); | 58 ExtensionApiTest::RunTestOnMainThreadLoop(); |
| 59 registrar_.RemoveAll(); | 59 registrar_.RemoveAll(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // content::NotificationObserver override: | 62 // content::NotificationObserver override: |
| 63 virtual void Observe(int type, | 63 virtual void Observe(int type, |
| 64 const content::NotificationSource& source, | 64 const content::NotificationSource& source, |
| 65 const content::NotificationDetails& details) OVERRIDE { | 65 const content::NotificationDetails& details) override { |
| 66 const std::string& content = *content::Details<std::string>(details).ptr(); | 66 const std::string& content = *content::Details<std::string>(details).ptr(); |
| 67 if (content == kAttemptClickAuthMessage) { | 67 if (content == kAttemptClickAuthMessage) { |
| 68 ScreenlockBridge::Get()->lock_handler()->SetAuthType( | 68 ScreenlockBridge::Get()->lock_handler()->SetAuthType( |
| 69 kTestUser, | 69 kTestUser, |
| 70 ScreenlockBridge::LockHandler::USER_CLICK, | 70 ScreenlockBridge::LockHandler::USER_CLICK, |
| 71 base::string16()); | 71 base::string16()); |
| 72 EasyUnlockService::Get(profile())->AttemptAuth(kTestUser); | 72 EasyUnlockService::Get(profile())->AttemptAuth(kTestUser); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 91 | 91 |
| 92 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, LockUnlock) { | 92 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, LockUnlock) { |
| 93 RunTest("screenlock_private/lock_unlock"); | 93 RunTest("screenlock_private/lock_unlock"); |
| 94 } | 94 } |
| 95 | 95 |
| 96 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) { | 96 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) { |
| 97 RunTest("screenlock_private/auth_type"); | 97 RunTest("screenlock_private/auth_type"); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace extensions | 100 } // namespace extensions |
| OLD | NEW |