Commit 0c91f41c authored by sque@chromium.org's avatar sque@chromium.org

Revert "chromeos: move screen lock handling to power manager client"

    
This reverts commit f9f5f14c.

Revert "Move chromeos specific code to ChromeBrowserMainPartsChromeos"
    
This reverts commit 922cff9c.

Revert "chromeos: remove power manager EXPECTs from login_browsertest"
    
This reverts commit 0a9298b6.



Review URL: http://codereview.chromium.org/8774035

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112651 0039d316-1c4b-4281-b951-d872f2087c98
parent 016ab203
......@@ -15,8 +15,8 @@
#include "chrome/browser/chromeos/audio_handler.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/cros/screen_lock_library.h"
#include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
#include "chrome/browser/chromeos/dbus/power_manager_client.h"
#include "chrome/browser/chromeos/dbus/update_engine_client.h"
#include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen.h"
#include "chrome/browser/chromeos/login/existing_user_controller.h"
......@@ -276,7 +276,7 @@ void TestingAutomationProvider::Login(DictionaryValue* args,
void TestingAutomationProvider::LockScreen(DictionaryValue* args,
IPC::Message* reply_message) {
new ScreenLockUnlockObserver(this, reply_message, true);
DBusThreadManager::Get()->GetPowerManagerClient()->
CrosLibrary::Get()->GetScreenLockLibrary()->
NotifyScreenLockRequested();
}
......
This diff is collapsed.
......@@ -56,9 +56,6 @@ class ChromeBrowserMainParts : public content::BrowserMainParts {
const content::MainFunctionParams& parameters);
// content::BrowserMainParts overrides.
// These are called in-order by content::BrowserMainLoop.
// Each stage calls the same stages in any ChromeBrowserMainExtraParts added
// with AddParts() from ChromeContentBrowserClient::CreateBrowserMainParts.
virtual void PreEarlyInitialization() OVERRIDE;
virtual void PostEarlyInitialization() OVERRIDE;
virtual void ToolkitInitialized() OVERRIDE;
......@@ -74,13 +71,6 @@ class ChromeBrowserMainParts : public content::BrowserMainParts {
virtual void PostStopThread(content::BrowserThread::ID identifier) OVERRIDE;
virtual void PostDestroyThreads() OVERRIDE;
// Additional stages for ChromeBrowserMainExtraParts. These stages are called
// in order from PreMainMessageLoopStart(). See implementation for details.
virtual void PreProfileInit();
virtual void PostProfileInit();
virtual void PreBrowserStart();
virtual void PostBrowserStart();
// Displays a warning message that we can't find any locale data files.
virtual void ShowMissingLocaleMessageBox() = 0;
......@@ -92,7 +82,6 @@ class ChromeBrowserMainParts : public content::BrowserMainParts {
}
Profile* profile() { return profile_; }
MetricsService* metrics() { return metrics_; }
private:
// Methods for |EarlyInitialization()| ---------------------------------------
......
......@@ -25,16 +25,10 @@ void ChromeBrowserMainExtraParts::PostMainMessageLoopStart() {
void ChromeBrowserMainExtraParts::ToolkitInitialized() {
}
void ChromeBrowserMainExtraParts::PreProfileInit() {
void ChromeBrowserMainExtraParts::PostBrowserProcessInit() {
}
void ChromeBrowserMainExtraParts::PostProfileInit() {
}
void ChromeBrowserMainExtraParts::PreBrowserStart() {
}
void ChromeBrowserMainExtraParts::PostBrowserStart() {
void ChromeBrowserMainExtraParts::PostProfileInitialized() {
}
void ChromeBrowserMainExtraParts::PreMainMessageLoopRun() {
......
......@@ -32,10 +32,8 @@ class ChromeBrowserMainExtraParts {
virtual void PostMainMessageLoopStart();
// MainMessageLoopRun methods.
virtual void PreProfileInit();
virtual void PostProfileInit();
virtual void PreBrowserStart();
virtual void PostBrowserStart();
virtual void PostBrowserProcessInit();
virtual void PostProfileInitialized();
virtual void PreMainMessageLoopRun();
virtual void PostMainMessageLoopRun();
......
......@@ -16,7 +16,7 @@ ChromeBrowserMainExtraPartsAura::ChromeBrowserMainExtraPartsAura()
: ChromeBrowserMainExtraParts() {
}
void ChromeBrowserMainExtraPartsAura::PreProfileInit() {
void ChromeBrowserMainExtraPartsAura::PostBrowserProcessInit() {
#if defined(OS_CHROMEOS)
if (chromeos::system::runtime_environment::IsRunningOnChromeOS())
aura::Desktop::set_use_fullscreen_host_window(true);
......
......@@ -13,7 +13,7 @@ class ChromeBrowserMainExtraPartsAura : public ChromeBrowserMainExtraParts {
public:
ChromeBrowserMainExtraPartsAura();
virtual void PreProfileInit() OVERRIDE;
virtual void PostBrowserProcessInit() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsAura);
......
......@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "chrome/browser/accessibility/accessibility_events.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/common/chrome_notification_types.h"
......@@ -20,9 +21,11 @@ SystemEventObserver* g_system_event_observer = NULL;
}
SystemEventObserver::SystemEventObserver() {
CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this);
}
SystemEventObserver::~SystemEventObserver() {
CrosLibrary::Get()->GetScreenLockLibrary()->RemoveObserver(this);
}
void SystemEventObserver::SystemResumed() {
......@@ -32,16 +35,19 @@ void SystemEventObserver::SystemResumed() {
chrome::NOTIFICATION_ACCESSIBILITY_WOKE_UP, &info);
}
void SystemEventObserver::LockScreen() {}
void SystemEventObserver::LockScreen(ScreenLockLibrary* screen_lock_library) {
}
void SystemEventObserver::UnlockScreen() {
void SystemEventObserver::UnlockScreen(ScreenLockLibrary* screen_lock_library) {
Profile* profile = ProfileManager::GetDefaultProfile();
ScreenUnlockedEventInfo info(profile);
SendAccessibilityNotification(
chrome::NOTIFICATION_ACCESSIBILITY_SCREEN_UNLOCKED, &info);
}
void SystemEventObserver::UnlockScreenFailed() {}
void SystemEventObserver::UnlockScreenFailed(
ScreenLockLibrary* screen_lock_library) {
}
// static
void SystemEventObserver::Initialize() {
......
......@@ -6,6 +6,7 @@
#define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SYSTEM_EVENT_OBSERVER_H_
#pragma once
#include "chrome/browser/chromeos/cros/screen_lock_library.h"
#include "chrome/browser/chromeos/dbus/power_manager_client.h"
namespace chromeos {
......@@ -13,7 +14,8 @@ namespace accessibility {
// A singleton class to observe system events like wake up from sleep and
// screen unlock.
class SystemEventObserver : public PowerManagerClient::Observer {
class SystemEventObserver : public PowerManagerClient::Observer,
public ScreenLockLibrary::Observer {
public:
virtual ~SystemEventObserver();
......@@ -21,13 +23,14 @@ class SystemEventObserver : public PowerManagerClient::Observer {
virtual void SystemResumed() OVERRIDE;
// ScreenLockLibrary::Observer override.
virtual void LockScreen() OVERRIDE;
virtual void LockScreen(ScreenLockLibrary* screen_lock_library) OVERRIDE;
// ScreenLockLibrary::Observer override.
virtual void UnlockScreen() OVERRIDE;
virtual void UnlockScreen(ScreenLockLibrary* screen_lock_library) OVERRIDE;
// ScreenLockLibrary::Observer override.
virtual void UnlockScreenFailed() OVERRIDE;
virtual void UnlockScreenFailed(ScreenLockLibrary* screen_lock_library)
OVERRIDE;
// Creates the global SystemEventObserver instance.
static void Initialize();
......
......@@ -27,14 +27,9 @@ class ChromeBrowserMainPartsChromeos : public ChromeBrowserMainPartsLinux {
virtual void PreEarlyInitialization() OVERRIDE;
virtual void PreMainMessageLoopStart() OVERRIDE;
virtual void PostMainMessageLoopStart() OVERRIDE;
virtual void PreMainMessageLoopRun() OVERRIDE;
virtual void PostMainMessageLoopRun() OVERRIDE;
// ChromeBrowserMainExtraParts overrodes.
virtual void PreProfileInit() OVERRIDE;
virtual void PostProfileInit() OVERRIDE;
virtual void PreBrowserStart() OVERRIDE;
virtual void PostBrowserStart() OVERRIDE;
private:
scoped_ptr<chromeos::BrightnessObserver> brightness_observer_;
scoped_ptr<chromeos::SessionManagerObserver> session_manager_observer_;
......
......@@ -25,10 +25,6 @@ class MockPowerManagerClient : public PowerManagerClient {
MOCK_METHOD0(RequestRestart, void(void));
MOCK_METHOD0(RequestShutdown, void(void));
MOCK_METHOD1(CalculateIdleTime, void(const CalculateIdleTimeCallback&));
MOCK_METHOD0(NotifyScreenLockRequested, void(void));
MOCK_METHOD0(NotifyScreenLockCompleted, void(void));
MOCK_METHOD0(NotifyScreenUnlockRequested, void(void));
MOCK_METHOD0(NotifyScreenUnlockCompleted, void(void));
};
} // namespace chromeos
......
......@@ -92,29 +92,6 @@ class PowerManagerClientImpl : public PowerManagerClient {
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&PowerManagerClientImpl::SignalConnected,
weak_ptr_factory_.GetWeakPtr()));
// Monitor the D-Bus signal for screen lock and unlock signals.
power_manager_proxy_->ConnectToSignal(
chromium::kChromiumInterface,
chromium::kLockScreenSignal,
base::Bind(&PowerManagerClientImpl::ScreenLockSignalReceived,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&PowerManagerClientImpl::SignalConnected,
weak_ptr_factory_.GetWeakPtr()));
power_manager_proxy_->ConnectToSignal(
chromium::kChromiumInterface,
chromium::kUnlockScreenSignal,
base::Bind(&PowerManagerClientImpl::ScreenUnlockSignalReceived,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&PowerManagerClientImpl::SignalConnected,
weak_ptr_factory_.GetWeakPtr()));
power_manager_proxy_->ConnectToSignal(
chromium::kChromiumInterface,
chromium::kUnlockScreenFailedSignal,
base::Bind(&PowerManagerClientImpl::ScreenUnlockFailedSignalReceived,
weak_ptr_factory_.GetWeakPtr()),
base::Bind(&PowerManagerClientImpl::SignalConnected,
weak_ptr_factory_.GetWeakPtr()));
}
virtual ~PowerManagerClientImpl() {
......@@ -199,22 +176,6 @@ class PowerManagerClientImpl : public PowerManagerClient {
weak_ptr_factory_.GetWeakPtr(), callback));
}
virtual void NotifyScreenLockRequested() OVERRIDE {
SimpleMethodCallToPowerManager(power_manager::kRequestLockScreenMethod);
}
virtual void NotifyScreenLockCompleted() OVERRIDE {
SimpleMethodCallToPowerManager(power_manager::kScreenIsLockedMethod);
}
virtual void NotifyScreenUnlockRequested() OVERRIDE {
SimpleMethodCallToPowerManager(power_manager::kRequestUnlockScreenMethod);
}
virtual void NotifyScreenUnlockCompleted() OVERRIDE {
SimpleMethodCallToPowerManager(power_manager::kScreenIsUnlockedMethod);
}
private:
// Called when a dbus signal is initially connected.
void SignalConnected(const std::string& interface_name,
......@@ -224,16 +185,6 @@ class PowerManagerClientImpl : public PowerManagerClient {
<< signal_name << ".";
}
// Make a method call to power manager with no arguments and no response.
void SimpleMethodCallToPowerManager(const std::string& method_name) {
dbus::MethodCall method_call(power_manager::kPowerManagerInterface,
method_name);
power_manager_proxy_->CallMethod(
&method_call,
dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
dbus::ObjectProxy::EmptyResponseCallback());
}
// Called when a brightness change signal is received.
void BrightnessChangedReceived(dbus::Signal* signal) {
dbus::MessageReader reader(signal);
......@@ -341,18 +292,6 @@ class PowerManagerClientImpl : public PowerManagerClient {
callback.Run(idle_time_ms/1000);
}
void ScreenLockSignalReceived(dbus::Signal* signal) {
FOR_EACH_OBSERVER(Observer, observers_, LockScreen());
}
void ScreenUnlockSignalReceived(dbus::Signal* signal) {
FOR_EACH_OBSERVER(Observer, observers_, UnlockScreen());
}
void ScreenUnlockFailedSignalReceived(dbus::Signal* signal) {
FOR_EACH_OBSERVER(Observer, observers_, UnlockScreenFailed());
}
dbus::ObjectProxy* power_manager_proxy_;
ObserverList<Observer> observers_;
base::WeakPtrFactory<PowerManagerClientImpl> weak_ptr_factory_;
......@@ -413,14 +352,6 @@ class PowerManagerClientStubImpl : public PowerManagerClient {
callback.Run(0);
}
virtual void NotifyScreenLockRequested() OVERRIDE {}
virtual void NotifyScreenLockCompleted() OVERRIDE {}
virtual void NotifyScreenUnlockRequested() OVERRIDE {}
virtual void NotifyScreenUnlockCompleted() OVERRIDE {}
private:
void Update() {
// We pause at 0 and 100% so that it's easier to check those conditions.
......
......@@ -54,15 +54,6 @@ class PowerManagerClient {
// Called when the system resumes from suspend.
virtual void SystemResumed() {}
// Called when the screen is locked.
virtual void LockScreen() {}
// Called when the screen is unlocked.
virtual void UnlockScreen() {}
// Called when the screen fails to unlock.
virtual void UnlockScreenFailed() {}
};
// Adds and removes the observer.
......@@ -90,18 +81,6 @@ class PowerManagerClient {
// encounters some error, it passes -1 to |callback|.
virtual void CalculateIdleTime(const CalculateIdleTimeCallback& callback) = 0;
// Notifies PowerManager that a user requested to lock the screen.
virtual void NotifyScreenLockRequested() = 0;
// Notifies PowerManager that screen lock has been completed.
virtual void NotifyScreenLockCompleted() = 0;
// Notifies PowerManager that a user unlocked the screen.
virtual void NotifyScreenUnlockRequested() = 0;
// Notifies PowerManager that screen is unlocked.
virtual void NotifyScreenUnlockCompleted() = 0;
// Creates the instance.
static PowerManagerClient* Create(dbus::Bus* bus);
......
......@@ -8,6 +8,7 @@
#include "chrome/browser/chromeos/cros/mock_cryptohome_library.h"
#include "chrome/browser/chromeos/cros/mock_library_loader.h"
#include "chrome/browser/chromeos/cros/mock_network_library.h"
#include "chrome/browser/chromeos/cros/mock_screen_lock_library.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_switches.h"
......@@ -23,7 +24,8 @@ using ::testing::Return;
class LoginTestBase : public CrosInProcessBrowserTest {
public:
LoginTestBase() : mock_cryptohome_library_(NULL) {
LoginTestBase() : mock_cryptohome_library_(NULL),
mock_screen_lock_library_(NULL) {
}
protected:
......@@ -31,12 +33,15 @@ class LoginTestBase : public CrosInProcessBrowserTest {
cros_mock_->InitStatusAreaMocks();
cros_mock_->SetStatusAreaMocksExpectations();
cros_mock_->InitMockCryptohomeLibrary();
cros_mock_->InitMockScreenLockLibrary();
mock_cryptohome_library_ = cros_mock_->mock_cryptohome_library();
mock_screen_lock_library_ = cros_mock_->mock_screen_lock_library();
EXPECT_CALL(*mock_cryptohome_library_, IsMounted())
.WillRepeatedly(Return(true));
}
MockCryptohomeLibrary* mock_cryptohome_library_;
MockScreenLockLibrary* mock_screen_lock_library_;
private:
DISALLOW_COPY_AND_ASSIGN(LoginTestBase);
......@@ -46,6 +51,12 @@ class LoginUserTest : public LoginTestBase {
protected:
virtual void SetUpInProcessBrowserTestFixture() {
LoginTestBase::SetUpInProcessBrowserTestFixture();
EXPECT_CALL(*mock_screen_lock_library_, AddObserver(_))
.Times(AtLeast(1))
.WillRepeatedly(Return());
EXPECT_CALL(*mock_screen_lock_library_, RemoveObserver(_))
.Times(AtLeast(1))
.WillRepeatedly(Return());
}
virtual void SetUpCommandLine(CommandLine* command_line) {
......
......@@ -14,10 +14,10 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/boot_times_loader.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/screen_lock_library.h"
#include "chrome/browser/chromeos/cros_settings.h"
#include "chrome/browser/chromeos/cros_settings_names.h"
#include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
#include "chrome/browser/chromeos/dbus/power_manager_client.h"
#include "chrome/browser/chromeos/login/login_utils.h"
#include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/prefs/pref_service.h"
......@@ -367,7 +367,7 @@ void LoginPerformer::RequestScreenLock() {
ResolveScreenLocked();
} else {
screen_lock_requested_ = true;
DBusThreadManager::Get()->GetPowerManagerClient()->
chromeos::CrosLibrary::Get()->GetScreenLockLibrary()->
NotifyScreenLockRequested();
}
}
......@@ -375,7 +375,7 @@ void LoginPerformer::RequestScreenLock() {
void LoginPerformer::RequestScreenUnlock() {
DVLOG(1) << "Screen unlock requested";
if (ScreenLocker::default_screen_locker()) {
DBusThreadManager::Get()->GetPowerManagerClient()->
chromeos::CrosLibrary::Get()->GetScreenLockLibrary()->
NotifyScreenUnlockRequested();
// Will unsubscribe from notifications once unlock is successful.
} else {
......
......@@ -16,8 +16,9 @@
#include "base/string_util.h"
#include "base/timer.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/screen_lock_library.h"
#include "chrome/browser/chromeos/dbus/dbus_thread_manager.h"
#include "chrome/browser/chromeos/dbus/power_manager_client.h"
#include "chrome/browser/chromeos/dbus/session_manager_client.h"
#include "chrome/browser/chromeos/input_method/input_method_manager.h"
#include "chrome/browser/chromeos/input_method/input_method_util.h"
......@@ -54,7 +55,7 @@ using content::BrowserThread;
namespace {
// Observer to start ScreenLocker when the screen lock
class ScreenLockObserver : public chromeos::PowerManagerClient::Observer,
class ScreenLockObserver : public chromeos::ScreenLockLibrary::Observer,
public content::NotificationObserver {
public:
ScreenLockObserver() {
......@@ -69,23 +70,22 @@ class ScreenLockObserver : public chromeos::PowerManagerClient::Observer,
if (type == chrome::NOTIFICATION_LOGIN_USER_CHANGED) {
// Register Screen Lock after login screen to make sure
// we don't show the screen lock on top of the login screen by accident.
chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
AddObserver(this);
chromeos::CrosLibrary::Get()->GetScreenLockLibrary()->AddObserver(this);
}
}
virtual void LockScreen() OVERRIDE {
virtual void LockScreen(chromeos::ScreenLockLibrary* obj) OVERRIDE {
VLOG(1) << "In: ScreenLockObserver::LockScreen";
SetupInputMethodsForScreenLocker();
chromeos::ScreenLocker::Show();
}
virtual void UnlockScreen() OVERRIDE {
virtual void UnlockScreen(chromeos::ScreenLockLibrary* obj) OVERRIDE {
RestoreInputMethods();
chromeos::ScreenLocker::Hide();
}
virtual void UnlockScreenFailed() OVERRIDE {
virtual void UnlockScreenFailed(chromeos::ScreenLockLibrary* obj) OVERRIDE {
chromeos::ScreenLocker::UnlockScreenFailed();
}
......@@ -271,8 +271,7 @@ void ScreenLocker::OnLoginSuccess(
service->SetPassphrase(password, false);
}
}
DBusThreadManager::Get()->GetPowerManagerClient()->
NotifyScreenUnlockRequested();
CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenUnlockRequested();
if (login_status_consumer_)
login_status_consumer_->OnLoginSuccess(username, password,
......@@ -363,8 +362,7 @@ void ScreenLocker::Show() {
// receive the response within timeout. Just send complete
// signal.
VLOG(1) << "Show: locker already exists. Just sending completion event.";
DBusThreadManager::Get()->GetPowerManagerClient()->
NotifyScreenLockCompleted();
CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenLockCompleted();
}
}
......@@ -418,8 +416,7 @@ ScreenLocker::~ScreenLocker() {
chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
content::Source<ScreenLocker>(this),
content::Details<bool>(&state));
DBusThreadManager::Get()->GetPowerManagerClient()->
NotifyScreenUnlockCompleted();
CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenUnlockCompleted();
}
void ScreenLocker::SetAuthenticator(Authenticator* authenticator) {
......@@ -438,8 +435,7 @@ void ScreenLocker::ScreenLockReady() {
chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
content::Source<ScreenLocker>(this),
content::Details<bool>(&state));
DBusThreadManager::Get()->GetPowerManagerClient()->
NotifyScreenLockCompleted();
CrosLibrary::Get()->GetScreenLockLibrary()->NotifyScreenLockCompleted();
}
} // namespace chromeos
......@@ -7,7 +7,7 @@
#include "base/message_loop.h"
#include "chrome/browser/automation/ui_controls.h"
#include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
#include "chrome/browser/chromeos/dbus/mock_power_manager_client.h"
#include "chrome/browser/chromeos/cros/mock_screen_lock_library.h"
#include "chrome/browser/chromeos/login/mock_authenticator.h"
#include "chrome/browser/chromeos/login/screen_locker.h"
#include "chrome/browser/chromeos/login/screen_locker_tester.h"
......@@ -97,19 +97,19 @@ namespace chromeos {
class ScreenLockerTest : public CrosInProcessBrowserTest {
public:
ScreenLockerTest() {
ScreenLockerTest() : mock_screen_lock_library_(NULL) {
}
protected:
MockPowerManagerClient mock_power_manager_client_;
MockScreenLockLibrary *mock_screen_lock_library_;
// Test the no password mode with different unlock scheme given by
// |unlock| function.
void TestNoPassword(void (unlock)(views::Widget*)) {
EXPECT_CALL(mock_power_manager_client_, NotifyScreenUnlockRequested())
EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenUnlockRequested())
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(mock_power_manager_client_, NotifyScreenLockCompleted())
EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenLockCompleted())
.Times(1)
.RetiresOnSaturation();
UserManager::Get()->GuestUserLoggedIn();
......@@ -151,10 +151,12 @@ class ScreenLockerTest : public CrosInProcessBrowserTest {
private:
virtual void SetUpInProcessBrowserTestFixture() {
cros_mock_->InitStatusAreaMocks();
EXPECT_CALL(mock_power_manager_client_, AddObserver(testing::_))
cros_mock_->InitMockScreenLockLibrary();
mock_screen_lock_library_ = cros_mock_->mock_screen_lock_library();
EXPECT_CALL(*mock_screen_lock_library_, AddObserver(testing::_))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(mock_power_manager_client_, NotifyScreenUnlockCompleted())
EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenUnlockCompleted())
.Times(1)
.RetiresOnSaturation();
// Expectations for the status are on the screen lock window.
......@@ -174,10 +176,10 @@ class ScreenLockerTest : public CrosInProcessBrowserTest {
// Temporarily disabling all screen locker tests while investigating the
// issue crbug.com/78764.
IN_PROC_BROWSER_TEST_F(ScreenLockerTest, DISABLED_TestBasic) {
EXPECT_CALL(mock_power_manager_client_, NotifyScreenUnlockRequested())
EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenUnlockRequested())
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(mock_power_manager_client_, NotifyScreenLockCompleted())
EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenLockCompleted())
.Times(1)
.RetiresOnSaturation();
UserManager::Get()->UserLoggedIn("user");
......@@ -215,10 +217,10 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, DISABLED_TestBasic) {
}
IN_PROC_BROWSER_TEST_F(ScreenLockerTest, DISABLED_TestFullscreenExit) {
EXPECT_CALL(mock_power_manager_client_, NotifyScreenUnlockRequested())
EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenUnlockRequested())
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(mock_power_manager_client_, NotifyScreenLockCompleted())
EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenLockCompleted())
.Times(1)
.RetiresOnSaturation();
scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester());
......@@ -274,7 +276,7 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, DISABLED_TestNoPasswordWithKeyPress) {
}
IN_PROC_BROWSER_TEST_F(ScreenLockerTest, DISABLED_TestShowTwice) {
EXPECT_CALL(mock_power_manager_client_, NotifyScreenLockCompleted())
EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenLockCompleted())
.Times(2)
.RetiresOnSaturation();
scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester());
......@@ -294,7 +296,7 @@ IN_PROC_BROWSER_TEST_F(ScreenLockerTest, DISABLED_TestShowTwice) {
}
IN_PROC_BROWSER_TEST_F(ScreenLockerTest, DISABLED_TestEscape) {
EXPECT_CALL(mock_power_manager_client_, NotifyScreenLockCompleted())
EXPECT_CALL(*mock_screen_lock_library_, NotifyScreenLockCompleted())
.Times(1)
.RetiresOnSaturation();
scoped_ptr<test::ScreenLockerTester> tester(ScreenLocker::GetTester());
......
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