Commit bf83cf6f authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: More cleanup on ScreenLockerTester

TBR=dtseng@chromium.org

Bug: 899777
Change-Id: Id56ad8bb68c95b4412fbc9ebacef7921216fe9ce
Reviewed-on: https://chromium-review.googlesource.com/c/1317924
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608415}
parent 7aa1330a
...@@ -240,8 +240,8 @@ IN_PROC_BROWSER_TEST_F(UsersPrivateApiLoginStatusTest, User) { ...@@ -240,8 +240,8 @@ IN_PROC_BROWSER_TEST_F(UsersPrivateApiLoginStatusTest, User) {
// Screenlock - logged in, screen locked. // Screenlock - logged in, screen locked.
IN_PROC_BROWSER_TEST_F(UsersPrivateApiLockStatusTest, ScreenLock) { IN_PROC_BROWSER_TEST_F(UsersPrivateApiLockStatusTest, ScreenLock) {
chromeos::ScreenLocker::Show(); chromeos::ScreenLocker::Show();
std::unique_ptr<chromeos::test::ScreenLockerTester> tester( std::unique_ptr<chromeos::ScreenLockerTester> tester =
chromeos::ScreenLocker::GetTester()); chromeos::ScreenLockerTester::Create();
content::WindowedNotificationObserver lock_state_observer( content::WindowedNotificationObserver lock_state_observer(
chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
content::NotificationService::AllSources()); content::NotificationService::AllSources());
......
...@@ -582,6 +582,14 @@ void ScreenLocker::SaveSyncPasswordHash(const UserContext& user_context) { ...@@ -582,6 +582,14 @@ void ScreenLocker::SaveSyncPasswordHash(const UserContext& user_context) {
if (profile) if (profile)
login::SaveSyncPasswordDataToProfile(user_context, profile); login::SaveSyncPasswordDataToProfile(user_context, profile);
} }
void ScreenLocker::SetAuthenticatorsForTesting(
scoped_refptr<Authenticator> authenticator,
scoped_refptr<ExtendedAuthenticator> extended_authenticator) {
authenticator_ = std::move(authenticator);
extended_authenticator_ = std::move(extended_authenticator);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// ScreenLocker, private: // ScreenLocker, private:
...@@ -613,10 +621,6 @@ ScreenLocker::~ScreenLocker() { ...@@ -613,10 +621,6 @@ ScreenLocker::~ScreenLocker() {
} }
} }
void ScreenLocker::SetAuthenticator(Authenticator* authenticator) {
authenticator_ = authenticator;
}
void ScreenLocker::ScreenLockReady() { void ScreenLocker::ScreenLockReady() {
locked_ = true; locked_ = true;
base::TimeDelta delta = base::Time::Now() - start_time_; base::TimeDelta delta = base::Time::Now() - start_time_;
......
...@@ -38,12 +38,6 @@ class ScreenlockIconProvider; ...@@ -38,12 +38,6 @@ class ScreenlockIconProvider;
class WebUIScreenLocker; class WebUIScreenLocker;
class ViewsScreenLocker; class ViewsScreenLocker;
namespace test {
class ScreenLockerTester;
class ScreenLockerViewsTester;
class WebUIScreenLockerTester;
} // namespace test
// ScreenLocker creates a WebUIScreenLocker which will display the lock UI. // ScreenLocker creates a WebUIScreenLocker which will display the lock UI.
// As well, it takes care of authenticating the user and managing a global // As well, it takes care of authenticating the user and managing a global
// instance of itself which will be deleted when the system is unlocked. // instance of itself which will be deleted when the system is unlocked.
...@@ -166,18 +160,17 @@ class ScreenLocker : public AuthStatusConsumer, ...@@ -166,18 +160,17 @@ class ScreenLocker : public AuthStatusConsumer,
// Hide the screen locker. // Hide the screen locker.
static void Hide(); static void Hide();
// Returns the tester
static test::ScreenLockerTester* GetTester();
// Saves sync password hash and salt to user profile prefs based on // Saves sync password hash and salt to user profile prefs based on
// |user_context|. // |user_context|.
void SaveSyncPasswordHash(const UserContext& user_context); void SaveSyncPasswordHash(const UserContext& user_context);
// Change the authenticators; should only be used by tests.
void SetAuthenticatorsForTesting(
scoped_refptr<Authenticator> authenticator,
scoped_refptr<ExtendedAuthenticator> extended_authenticator);
private: private:
friend class base::DeleteHelper<ScreenLocker>; friend class base::DeleteHelper<ScreenLocker>;
friend class test::ScreenLockerTester;
friend class test::ScreenLockerViewsTester;
friend class test::WebUIScreenLockerTester;
friend class WebUIScreenLocker; friend class WebUIScreenLocker;
friend class ViewsScreenLocker; friend class ViewsScreenLocker;
...@@ -201,9 +194,6 @@ class ScreenLocker : public AuthStatusConsumer, ...@@ -201,9 +194,6 @@ class ScreenLocker : public AuthStatusConsumer,
void OnFingerprintAuthFailure(const user_manager::User& user); void OnFingerprintAuthFailure(const user_manager::User& user);
// Sets the authenticator.
void SetAuthenticator(Authenticator* authenticator);
// Called when the screen lock is ready. // Called when the screen lock is ready.
void ScreenLockReady(); void ScreenLockReady();
......
...@@ -43,6 +43,7 @@ using testing::_; ...@@ -43,6 +43,7 @@ using testing::_;
using testing::AnyNumber; using testing::AnyNumber;
using testing::Return; using testing::Return;
namespace chromeos {
namespace { namespace {
// An object that wait for lock state and fullscreen state. // An object that wait for lock state and fullscreen state.
...@@ -68,8 +69,7 @@ class Waiter : public content::NotificationObserver { ...@@ -68,8 +69,7 @@ class Waiter : public content::NotificationObserver {
// Wait until the two conditions are met. // Wait until the two conditions are met.
void Wait(bool locker_state, bool fullscreen) { void Wait(bool locker_state, bool fullscreen) {
std::unique_ptr<chromeos::test::ScreenLockerTester> tester( std::unique_ptr<ScreenLockerTester> tester = ScreenLockerTester::Create();
chromeos::ScreenLocker::GetTester());
while (tester->IsLocked() != locker_state || while (tester->IsLocked() != locker_state ||
browser_->window()->IsFullscreen() != fullscreen) { browser_->window()->IsFullscreen() != fullscreen) {
base::RunLoop run_loop; base::RunLoop run_loop;
...@@ -91,8 +91,6 @@ class Waiter : public content::NotificationObserver { ...@@ -91,8 +91,6 @@ class Waiter : public content::NotificationObserver {
} // namespace } // namespace
namespace chromeos {
class ScreenLockerTest : public InProcessBrowserTest { class ScreenLockerTest : public InProcessBrowserTest {
public: public:
ScreenLockerTest() : fake_session_manager_client_(NULL) {} ScreenLockerTest() : fake_session_manager_client_(NULL) {}
...@@ -100,7 +98,7 @@ class ScreenLockerTest : public InProcessBrowserTest { ...@@ -100,7 +98,7 @@ class ScreenLockerTest : public InProcessBrowserTest {
protected: protected:
FakeSessionManagerClient* fake_session_manager_client_; FakeSessionManagerClient* fake_session_manager_client_;
void LockScreen(test::ScreenLockerTester* tester) { void LockScreen(ScreenLockerTester* tester) {
ScreenLocker::Show(); ScreenLocker::Show();
content::WindowedNotificationObserver lock_state_observer( content::WindowedNotificationObserver lock_state_observer(
chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
...@@ -156,7 +154,7 @@ IN_PROC_BROWSER_TEST_F(WebUiScreenLockerTest, TestBasic) { ...@@ -156,7 +154,7 @@ IN_PROC_BROWSER_TEST_F(WebUiScreenLockerTest, TestBasic) {
if (features::IsUsingWindowService()) if (features::IsUsingWindowService())
return; return;
ScreenLocker::Show(); ScreenLocker::Show();
std::unique_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester()); std::unique_ptr<ScreenLockerTester> tester = ScreenLockerTester::Create();
content::WindowedNotificationObserver lock_state_observer( content::WindowedNotificationObserver lock_state_observer(
chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
content::NotificationService::AllSources()); content::NotificationService::AllSources());
...@@ -211,7 +209,7 @@ IN_PROC_BROWSER_TEST_F(WebUiScreenLockerTest, MAYBE_TestFullscreenExit) { ...@@ -211,7 +209,7 @@ IN_PROC_BROWSER_TEST_F(WebUiScreenLockerTest, MAYBE_TestFullscreenExit) {
// does not have all the pixels (e.g. the shelf is auto hidden instead of // does not have all the pixels (e.g. the shelf is auto hidden instead of
// hidden), locking the screen should not exit fullscreen. The shelf is // hidden), locking the screen should not exit fullscreen. The shelf is
// auto hidden when in immersive fullscreen. // auto hidden when in immersive fullscreen.
std::unique_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester()); std::unique_ptr<ScreenLockerTester> tester = ScreenLockerTester::Create();
BrowserWindow* browser_window = browser()->window(); BrowserWindow* browser_window = browser()->window();
ash::wm::WindowState* window_state = ash::wm::WindowState* window_state =
ash::wm::GetWindowState(browser_window->GetNativeWindow()); ash::wm::GetWindowState(browser_window->GetNativeWindow());
...@@ -300,7 +298,7 @@ void UnlockKeyPress(views::Widget* widget) { ...@@ -300,7 +298,7 @@ void UnlockKeyPress(views::Widget* widget) {
} }
IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestShowTwice) { IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestShowTwice) {
std::unique_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester()); std::unique_ptr<ScreenLockerTester> tester = ScreenLockerTester::Create();
LockScreen(tester.get()); LockScreen(tester.get());
// Calling Show again simply send LockCompleted signal. // Calling Show again simply send LockCompleted signal.
......
...@@ -8,10 +8,8 @@ ...@@ -8,10 +8,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/chromeos/login/lock/screen_locker.h" #include "chrome/browser/chromeos/login/lock/screen_locker.h"
#include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h"
#include "chromeos/login/auth/auth_status_consumer.h" #include "chromeos/login/auth/auth_status_consumer.h"
...@@ -22,177 +20,143 @@ ...@@ -22,177 +20,143 @@
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
#include "content/public/test/test_utils.h" #include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/widget/root_view.h"
using content::WebContents;
namespace chromeos {
namespace { namespace {
// This class is used to observe state of the global ScreenLocker instance, // This class is used to observe state of the global ScreenLocker instance,
// which can go away as a result of a successful authentication. As such, // which can go away as a result of a successful authentication. As such,
// it needs to directly reference the global ScreenLocker. // it needs to directly reference the global ScreenLocker.
class LoginAttemptObserver : public chromeos::AuthStatusConsumer { class LoginAttemptObserver : public AuthStatusConsumer {
public: public:
LoginAttemptObserver(); LoginAttemptObserver() : AuthStatusConsumer() {
~LoginAttemptObserver() override; ScreenLocker::default_screen_locker()->SetLoginStatusConsumer(this);
}
void WaitForAttempt(); ~LoginAttemptObserver() override {
if (ScreenLocker::default_screen_locker())
ScreenLocker::default_screen_locker()->SetLoginStatusConsumer(nullptr);
}
// Overridden from AuthStatusConsumer: void WaitForAttempt() {
void OnAuthFailure(const chromeos::AuthFailure& error) override { if (!login_attempted_) {
LoginAttempted(); run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->Run();
run_loop_.release();
}
ASSERT_TRUE(login_attempted_);
} }
void OnAuthSuccess(const chromeos::UserContext& credentials) override { // AuthStatusConsumer:
void OnAuthFailure(const AuthFailure& error) override { LoginAttempted(); }
void OnAuthSuccess(const UserContext& credentials) override {
LoginAttempted(); LoginAttempted();
} }
private: private:
void LoginAttempted(); void LoginAttempted() {
login_attempted_ = true;
if (run_loop_)
run_loop_->QuitWhenIdle();
}
bool login_attempted_; bool login_attempted_ = false;
bool waiting_; std::unique_ptr<base::RunLoop> run_loop_;
DISALLOW_COPY_AND_ASSIGN(LoginAttemptObserver); DISALLOW_COPY_AND_ASSIGN(LoginAttemptObserver);
}; };
LoginAttemptObserver::LoginAttemptObserver()
: chromeos::AuthStatusConsumer(), login_attempted_(false), waiting_(false) {
chromeos::ScreenLocker::default_screen_locker()->SetLoginStatusConsumer(this);
}
LoginAttemptObserver::~LoginAttemptObserver() {
chromeos::ScreenLocker* global_locker =
chromeos::ScreenLocker::default_screen_locker();
if (global_locker)
global_locker->SetLoginStatusConsumer(NULL);
}
void LoginAttemptObserver::WaitForAttempt() {
if (!login_attempted_) {
waiting_ = true;
content::RunMessageLoop();
waiting_ = false;
}
ASSERT_TRUE(login_attempted_);
}
void LoginAttemptObserver::LoginAttempted() {
login_attempted_ = true;
if (waiting_)
base::RunLoop::QuitCurrentWhenIdleDeprecated();
}
} // namespace
namespace chromeos {
namespace test {
class WebUIScreenLockerTester : public ScreenLockerTester { class WebUIScreenLockerTester : public ScreenLockerTester {
public: public:
// ScreenLockerTester overrides: WebUIScreenLockerTester() = default;
void SetPassword(const std::string& password) override; ~WebUIScreenLockerTester() override = default;
std::string GetPassword() override;
void EnterPassword(const std::string& password) override; // ScreenLockerTester:
void EnterPassword(const std::string& password) override {
bool result;
SetPassword(password);
// Verify password is set.
ASSERT_EQ(password, GetPassword());
// Verify that "reauth" warning is hidden.
std::unique_ptr<base::Value> v = content::ExecuteScriptAndGetValue(
GetMainFrame(),
"window.getComputedStyle("
" $('pod-row').pods[0].querySelector('.reauth-hint-container'))"
" .display == 'none'");
ASSERT_TRUE(v->GetAsBoolean(&result));
ASSERT_TRUE(result);
// Attempt to sign in.
LoginAttemptObserver login;
v = content::ExecuteScriptAndGetValue(GetMainFrame(),
"$('pod-row').pods[0].activate();");
ASSERT_TRUE(v->GetAsBoolean(&result));
ASSERT_TRUE(result);
// Wait for login attempt.
login.WaitForAttempt();
}
private: private:
friend class chromeos::ScreenLocker; void SetPassword(const std::string& password) {
GetMainFrame()->ExecuteJavaScriptForTests(base::ASCIIToUTF16(
base::StringPrintf("$('pod-row').pods[0].passwordElement.value = '%s';",
password.c_str())));
}
WebUIScreenLockerTester() {} std::string GetPassword() {
std::string result;
std::unique_ptr<base::Value> v = content::ExecuteScriptAndGetValue(
GetMainFrame(), "$('pod-row').pods[0].passwordElement.value;");
CHECK(v->GetAsString(&result));
return result;
}
content::RenderFrameHost* GetMainFrame() const; content::RenderFrameHost* GetMainFrame() {
return webui()->GetWebContents()->GetMainFrame();
}
// Returns the ScreenLockerWebUI object. // Returns the ScreenLockerWebUI object.
WebUIScreenLocker* webui_screen_locker() const; WebUIScreenLocker* webui_screen_locker() {
DCHECK(ScreenLocker::default_screen_locker());
return ScreenLocker::default_screen_locker()->web_ui_for_testing();
}
// Returns the WebUI object from the screen locker. // Returns the WebUI object from the screen locker.
content::WebUI* webui() const; content::WebUI* webui() {
DCHECK(webui_screen_locker()->webui_ready_for_testing());
content::WebUI* webui = webui_screen_locker()->GetWebUI();
DCHECK(webui);
return webui;
}
DISALLOW_COPY_AND_ASSIGN(WebUIScreenLockerTester); DISALLOW_COPY_AND_ASSIGN(WebUIScreenLockerTester);
}; };
void WebUIScreenLockerTester::SetPassword(const std::string& password) { } // namespace
GetMainFrame()->ExecuteJavaScriptForTests(base::ASCIIToUTF16(
base::StringPrintf("$('pod-row').pods[0].passwordElement.value = '%s';",
password.c_str())));
}
std::string WebUIScreenLockerTester::GetPassword() {
std::string result;
std::unique_ptr<base::Value> v = content::ExecuteScriptAndGetValue(
GetMainFrame(), "$('pod-row').pods[0].passwordElement.value;");
CHECK(v->GetAsString(&result));
return result;
}
void WebUIScreenLockerTester::EnterPassword(const std::string& password) {
bool result;
SetPassword(password);
// Verify password is set.
ASSERT_EQ(password, GetPassword());
// Verify that "reauth" warning is hidden.
std::unique_ptr<base::Value> v = content::ExecuteScriptAndGetValue(
GetMainFrame(),
"window.getComputedStyle("
" $('pod-row').pods[0].querySelector('.reauth-hint-container'))"
" .display == 'none'");
ASSERT_TRUE(v->GetAsBoolean(&result));
ASSERT_TRUE(result);
// Attempt to sign in.
LoginAttemptObserver login;
v = content::ExecuteScriptAndGetValue(GetMainFrame(),
"$('pod-row').pods[0].activate();");
ASSERT_TRUE(v->GetAsBoolean(&result));
ASSERT_TRUE(result);
// Wait for login attempt.
login.WaitForAttempt();
}
content::RenderFrameHost* WebUIScreenLockerTester::GetMainFrame() const {
return webui()->GetWebContents()->GetMainFrame();
}
WebUIScreenLocker* WebUIScreenLockerTester::webui_screen_locker() const {
DCHECK(ScreenLocker::screen_locker_);
return ScreenLocker::screen_locker_->web_ui_for_testing();
}
content::WebUI* WebUIScreenLockerTester::webui() const { // static
DCHECK(webui_screen_locker()->webui_ready_); std::unique_ptr<ScreenLockerTester> ScreenLockerTester::Create() {
content::WebUI* webui = webui_screen_locker()->GetWebUI(); return std::make_unique<WebUIScreenLockerTester>();
DCHECK(webui);
return webui;
} }
ScreenLockerTester::ScreenLockerTester() {} ScreenLockerTester::ScreenLockerTester() {}
ScreenLockerTester::~ScreenLockerTester() {} ScreenLockerTester::~ScreenLockerTester() {}
bool ScreenLockerTester::IsLocked() {
return ScreenLocker::screen_locker_ && ScreenLocker::screen_locker_->locked_;
}
void ScreenLockerTester::InjectStubUserContext( void ScreenLockerTester::InjectStubUserContext(
const UserContext& user_context) { const UserContext& user_context) {
DCHECK(ScreenLocker::screen_locker_); auto* locker = ScreenLocker::default_screen_locker();
ScreenLocker::screen_locker_->SetAuthenticator( locker->SetAuthenticatorsForTesting(
new StubAuthenticator(ScreenLocker::screen_locker_, user_context)); base::MakeRefCounted<StubAuthenticator>(locker, user_context),
ScreenLocker::screen_locker_->extended_authenticator_ = base::MakeRefCounted<FakeExtendedAuthenticator>(locker, user_context));
new FakeExtendedAuthenticator(ScreenLocker::screen_locker_, user_context);
} }
} // namespace test bool ScreenLockerTester::IsLocked() {
return ScreenLocker::default_screen_locker() &&
test::ScreenLockerTester* ScreenLocker::GetTester() { ScreenLocker::default_screen_locker()->locked();
return new test::WebUIScreenLockerTester();
} }
} // namespace chromeos } // namespace chromeos
...@@ -5,18 +5,20 @@ ...@@ -5,18 +5,20 @@
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_TESTER_H_ #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_TESTER_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_TESTER_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_TESTER_H_
#include <memory>
#include <string> #include <string>
namespace chromeos { namespace chromeos {
class UserContext; class UserContext;
namespace test {
// ScreenLockerTester provides access to the private state/function // ScreenLockerTester provides access to the private state/function
// of ScreenLocker class. Used to implement unit tests. // of ScreenLocker class. Used to implement unit tests.
class ScreenLockerTester { class ScreenLockerTester {
public: public:
// Create a new tester.
static std::unique_ptr<ScreenLockerTester> Create();
ScreenLockerTester(); ScreenLockerTester();
virtual ~ScreenLockerTester(); virtual ~ScreenLockerTester();
...@@ -26,18 +28,10 @@ class ScreenLockerTester { ...@@ -26,18 +28,10 @@ class ScreenLockerTester {
// Injects StubAuthenticator that uses the credentials in |user_context|. // Injects StubAuthenticator that uses the credentials in |user_context|.
virtual void InjectStubUserContext(const UserContext& user_context); virtual void InjectStubUserContext(const UserContext& user_context);
// Sets the password text. // Enters and submits the given password.
virtual void SetPassword(const std::string& password) = 0;
// Gets the password text.
virtual std::string GetPassword() = 0;
// Emulates entring a password.
virtual void EnterPassword(const std::string& password) = 0; virtual void EnterPassword(const std::string& password) = 0;
}; };
} // namespace test
} // namespace chromeos } // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_TESTER_H_ #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOCK_SCREEN_LOCKER_TESTER_H_
...@@ -38,10 +38,6 @@ namespace login { ...@@ -38,10 +38,6 @@ namespace login {
class NetworkStateHelper; class NetworkStateHelper;
} }
namespace test {
class WebUIScreenLockerTester;
}
// Displays a WebUI lock screen based on the Oobe account picker screen. // Displays a WebUI lock screen based on the Oobe account picker screen.
class WebUIScreenLocker : public WebUILoginView, class WebUIScreenLocker : public WebUILoginView,
public ScreenLocker::Delegate, public ScreenLocker::Delegate,
...@@ -62,8 +58,9 @@ class WebUIScreenLocker : public WebUILoginView, ...@@ -62,8 +58,9 @@ class WebUIScreenLocker : public WebUILoginView,
// ScreenLockReady is called when all initialization has finished. // ScreenLockReady is called when all initialization has finished.
void LockScreen(); void LockScreen();
bool webui_ready_for_testing() const { return webui_ready_; }
private: private:
friend class test::WebUIScreenLockerTester;
// Returns true if the lock screen should be preloaded. // Returns true if the lock screen should be preloaded.
static bool ShouldPreloadLockScreen(); static bool ShouldPreloadLockScreen();
......
...@@ -238,7 +238,8 @@ class ShutdownPolicyLockerTest : public ShutdownPolicyBaseTest { ...@@ -238,7 +238,8 @@ class ShutdownPolicyLockerTest : public ShutdownPolicyBaseTest {
// Bring up the locker screen. // Bring up the locker screen.
ScreenLocker::Show(); ScreenLocker::Show();
std::unique_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester()); std::unique_ptr<chromeos::ScreenLockerTester> tester =
chromeos::ScreenLockerTester::Create();
content::WindowedNotificationObserver lock_state_observer( content::WindowedNotificationObserver lock_state_observer(
chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
content::NotificationService::AllSources()); content::NotificationService::AllSources());
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
using chromeos::ProfileHelper; using chromeos::ProfileHelper;
using chromeos::ScreenLocker; using chromeos::ScreenLocker;
using chromeos::ScreenLockerTester;
using user_manager::UserManager; using user_manager::UserManager;
using chromeos::test::ScreenLockerTester;
using content::BrowserThread; using content::BrowserThread;
namespace extensions { namespace extensions {
...@@ -338,7 +338,7 @@ class BrailleDisplayPrivateAPIUserTest : public BrailleDisplayPrivateApiTest { ...@@ -338,7 +338,7 @@ class BrailleDisplayPrivateAPIUserTest : public BrailleDisplayPrivateApiTest {
#endif #endif
IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateAPIUserTest, IN_PROC_BROWSER_TEST_F(BrailleDisplayPrivateAPIUserTest,
MAYBE_KeyEventOnLockScreen) { MAYBE_KeyEventOnLockScreen) {
std::unique_ptr<ScreenLockerTester> tester(ScreenLocker::GetTester()); std::unique_ptr<ScreenLockerTester> tester = ScreenLockerTester::Create();
// Log in. // Log in.
session_manager::SessionManager::Get()->CreateSession( session_manager::SessionManager::Get()->CreateSession(
AccountId::FromUserEmailGaiaId(kTestUserName, kTestUserGaiaId), AccountId::FromUserEmailGaiaId(kTestUserName, kTestUserGaiaId),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment