OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/login/lock/screen_locker_tester.h" | 5 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 13 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
14 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" | 14 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" |
15 #include "chromeos/login/auth/auth_status_consumer.h" | 15 #include "chromeos/login/auth/auth_status_consumer.h" |
16 #include "chromeos/login/auth/fake_extended_authenticator.h" | 16 #include "chromeos/login/auth/fake_extended_authenticator.h" |
17 #include "chromeos/login/auth/mock_authenticator.h" | 17 #include "chromeos/login/auth/stub_authenticator.h" |
18 #include "content/public/browser/render_frame_host.h" | 18 #include "content/public/browser/render_frame_host.h" |
19 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
21 #include "content/public/browser/web_ui.h" | 21 #include "content/public/browser/web_ui.h" |
22 #include "content/public/test/test_utils.h" | 22 #include "content/public/test/test_utils.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "ui/views/controls/button/button.h" | 24 #include "ui/views/controls/button/button.h" |
24 #include "ui/views/controls/label.h" | 25 #include "ui/views/controls/label.h" |
25 #include "ui/views/controls/textfield/textfield.h" | 26 #include "ui/views/controls/textfield/textfield.h" |
26 #include "ui/views/widget/root_view.h" | 27 #include "ui/views/widget/root_view.h" |
27 | 28 |
28 using content::WebContents; | 29 using content::WebContents; |
29 | 30 |
30 namespace { | 31 namespace { |
31 | 32 |
32 // This class is used to observe state of the global ScreenLocker instance, | 33 // This class is used to observe state of the global ScreenLocker instance, |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 } | 193 } |
193 | 194 |
194 ScreenLockerTester::~ScreenLockerTester() { | 195 ScreenLockerTester::~ScreenLockerTester() { |
195 } | 196 } |
196 | 197 |
197 bool ScreenLockerTester::IsLocked() { | 198 bool ScreenLockerTester::IsLocked() { |
198 return ScreenLocker::screen_locker_ && | 199 return ScreenLocker::screen_locker_ && |
199 ScreenLocker::screen_locker_->locked_; | 200 ScreenLocker::screen_locker_->locked_; |
200 } | 201 } |
201 | 202 |
202 void ScreenLockerTester::InjectMockAuthenticator( | 203 void ScreenLockerTester::InjectStubUserContext( |
203 const UserContext& user_context) { | 204 const UserContext& user_context) { |
204 DCHECK(ScreenLocker::screen_locker_); | 205 DCHECK(ScreenLocker::screen_locker_); |
205 ScreenLocker::screen_locker_->SetAuthenticator( | 206 ScreenLocker::screen_locker_->SetAuthenticator( |
206 new MockAuthenticator(ScreenLocker::screen_locker_, user_context)); | 207 new StubAuthenticator(ScreenLocker::screen_locker_, user_context)); |
207 ScreenLocker::screen_locker_->extended_authenticator_ = | 208 ScreenLocker::screen_locker_->extended_authenticator_ = |
208 new FakeExtendedAuthenticator(ScreenLocker::screen_locker_, user_context); | 209 new FakeExtendedAuthenticator(ScreenLocker::screen_locker_, user_context); |
209 } | 210 } |
210 | 211 |
211 } // namespace test | 212 } // namespace test |
212 | 213 |
213 test::ScreenLockerTester* ScreenLocker::GetTester() { | 214 test::ScreenLockerTester* ScreenLocker::GetTester() { |
214 return new test::WebUIScreenLockerTester(); | 215 return new test::WebUIScreenLockerTester(); |
215 } | 216 } |
216 | 217 |
217 } // namespace chromeos | 218 } // namespace chromeos |
OLD | NEW |