Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc

Issue 585213002: [Easy signin] Wire up userClick auth attempt to easy unlock app and back (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@easy_signin_focused_user_changed_observer
Patch Set: fix screenlock private test Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/signin_manager_factory.h" 9 #include "chrome/browser/signin/signin_manager_factory.h"
9 #include "components/signin/core/browser/signin_manager.h" 10 #include "components/signin/core/browser/signin_manager.h"
10 #include "components/signin/core/common/profile_management_switches.h" 11 #include "components/signin/core/common/profile_management_switches.h"
11 #include "content/public/browser/notification_service.h" 12 #include "content/public/browser/notification_service.h"
12 #include "extensions/browser/api/test/test_api.h" 13 #include "extensions/browser/api/test/test_api.h"
13 #include "extensions/browser/notification_types.h" 14 #include "extensions/browser/notification_types.h"
14 #include "extensions/common/switches.h" 15 #include "extensions/common/switches.h"
15 16
16 namespace extensions { 17 namespace extensions {
17 18
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // content::NotificationObserver override: 62 // content::NotificationObserver override:
62 virtual void Observe(int type, 63 virtual void Observe(int type,
63 const content::NotificationSource& source, 64 const content::NotificationSource& source,
64 const content::NotificationDetails& details) OVERRIDE { 65 const content::NotificationDetails& details) OVERRIDE {
65 const std::string& content = *content::Details<std::string>(details).ptr(); 66 const std::string& content = *content::Details<std::string>(details).ptr();
66 if (content == kAttemptClickAuthMessage) { 67 if (content == kAttemptClickAuthMessage) {
67 ScreenlockBridge::Get()->lock_handler()->SetAuthType( 68 ScreenlockBridge::Get()->lock_handler()->SetAuthType(
68 kTestUser, 69 kTestUser,
69 ScreenlockBridge::LockHandler::USER_CLICK, 70 ScreenlockBridge::LockHandler::USER_CLICK,
70 base::string16()); 71 base::string16());
71 extensions::ScreenlockPrivateEventRouter* router = 72 EasyUnlockService::Get(profile())->AttemptAuth(kTestUser);
72 extensions::ScreenlockPrivateEventRouter::GetFactoryInstance()->Get(
73 profile());
74 router->OnAuthAttempted(
75 ScreenlockBridge::Get()->lock_handler()->GetAuthType(kTestUser), "");
76 } 73 }
77 } 74 }
78 75
79 // Loads |extension_name| as appropriate for the platform and waits for a 76 // Loads |extension_name| as appropriate for the platform and waits for a
80 // pass / fail notification. 77 // pass / fail notification.
81 void RunTest(const std::string& extension_name) { 78 void RunTest(const std::string& extension_name) {
82 #if defined(OS_CHROMEOS) 79 #if defined(OS_CHROMEOS)
83 ASSERT_TRUE(RunComponentExtensionTest(extension_name)) << message_; 80 ASSERT_TRUE(RunComponentExtensionTest(extension_name)) << message_;
84 #else 81 #else
85 ASSERT_TRUE(RunExtensionTest(extension_name)) << message_; 82 ASSERT_TRUE(RunExtensionTest(extension_name)) << message_;
86 #endif 83 #endif
87 } 84 }
88 85
89 private: 86 private:
90 content::NotificationRegistrar registrar_; 87 content::NotificationRegistrar registrar_;
91 88
92 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateApiTest); 89 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateApiTest);
93 }; 90 };
94 91
95 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, LockUnlock) { 92 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, LockUnlock) {
96 RunTest("screenlock_private/lock_unlock"); 93 RunTest("screenlock_private/lock_unlock");
97 } 94 }
98 95
99 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) { 96 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) {
100 RunTest("screenlock_private/auth_type"); 97 RunTest("screenlock_private/auth_type");
101 } 98 }
102 99
103 } // namespace extensions 100 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698