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

Side by Side Diff: chrome/browser/chromeos/extensions/screenlock_private_apitest.cc

Issue 168623003: Add chrome.screenlockPrivate API functions to handle alternate auth types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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 | Annotate | Revision Log
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 "chrome/browser/chrome_notification_types.h"
6 #include "chrome/browser/chromeos/login/screen_locker.h"
7 #include "chrome/browser/chromeos/login/user.h"
8 #include "chrome/browser/extensions/api/test/test_api.h"
5 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "content/public/browser/notification_service.h"
6 11
7 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ScreenlockPrivateApiTest) { 12 namespace extensions {
8 ASSERT_TRUE(RunExtensionTest("screenlockPrivate")) << message_; 13
14 namespace {
15
16 const char kAttemptClickAuthMessage[] = "attemptClickAuth";
17
18 } // namespace
19
20 class ScreenlockPrivateApiTest : public ExtensionApiTest,
21 public content::NotificationObserver {
22 public:
23 ScreenlockPrivateApiTest() {}
24
25 virtual ~ScreenlockPrivateApiTest() {}
26
27 protected:
28 chromeos::ScreenLocker* GetScreenLocker() {
29 chromeos::ScreenLocker* locker =
30 chromeos::ScreenLocker::default_screen_locker();
31 EXPECT_TRUE(locker);
32 return locker;
33 }
34
35 // ExtensionApiTest override:
36 virtual void RunTestOnMainThreadLoop() OVERRIDE {
37 registrar_.Add(this,
38 chrome::NOTIFICATION_EXTENSION_TEST_MESSAGE,
39 content::NotificationService::AllSources());
40 ExtensionApiTest::RunTestOnMainThreadLoop();
41 registrar_.RemoveAll();
42 }
43
44 // content::NotificationObserver override:
45 virtual void Observe(int type,
46 const content::NotificationSource& source,
47 const content::NotificationDetails& details) OVERRIDE {
48 const std::string& content = *content::Details<std::string>(details).ptr();
49 if (content == kAttemptClickAuthMessage) {
50 chromeos::ScreenLocker* locker = GetScreenLocker();
51 const chromeos::UserList& users = locker->users();
52 EXPECT_GE(1u, users.size());
53 GetScreenLocker()->Authenticate(
54 chromeos::UserContext(users[0]->email(), "", ""));
55 }
56 }
57
58 content::NotificationRegistrar registrar_;
59 };
60
61 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, LockUnlock) {
62 ASSERT_TRUE(RunExtensionTest("screenlock_private/lock_unlock")) << message_;
9 } 63 }
64
65 IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) {
66 ASSERT_TRUE(RunExtensionTest("screenlock_private/auth_type")) << message_;
67 }
68
69 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/screenlock_private_api.cc ('k') | chrome/browser/chromeos/login/screen_locker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698