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

Unified Diff: chrome/browser/signin/easy_unlock_service_browsertest_chromeos.cc

Issue 535343003: Add test case for unloading Easy Unlock app when system suspends. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move ifdef out 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/signin/easy_unlock_service_browsertest_chromeos.cc
diff --git a/chrome/browser/signin/easy_unlock_service_browsertest_chromeos.cc b/chrome/browser/signin/easy_unlock_service_browsertest_chromeos.cc
index a90b95933210e964277223936cde81d696355d7b..f69c3b2f6547f075f22599111e00c029d4b402bc 100644
--- a/chrome/browser/signin/easy_unlock_service_browsertest_chromeos.cc
+++ b/chrome/browser/signin/easy_unlock_service_browsertest_chromeos.cc
@@ -16,6 +16,8 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
+#include "chromeos/dbus/dbus_thread_manager.h"
+#include "chromeos/dbus/fake_power_manager_client.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "components/policy/core/common/policy_map.h"
@@ -28,6 +30,9 @@
#include "policy/policy_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
+using chromeos::DBusThreadManagerSetter;
+using chromeos::FakePowerManagerClient;
+using chromeos::PowerManagerClient;
using chromeos::ProfileHelper;
using chromeos::LoginManagerTest;
using chromeos::StartupUtils;
@@ -100,6 +105,12 @@ class EasyUnlockServiceTest : public InProcessBrowserTest {
mock_adapter_ = new testing::NiceMock<MockBluetoothAdapter>();
SetUpBluetoothMock(mock_adapter_, is_bluetooth_adapter_present_);
+
+ scoped_ptr<DBusThreadManagerSetter> dbus_setter =
+ chromeos::DBusThreadManager::GetSetterForTesting();
+ power_manager_client_ = new FakePowerManagerClient;
+ dbus_setter->SetPowerManagerClient(
+ scoped_ptr<PowerManagerClient>(power_manager_client_));
}
Profile* profile() const { return browser()->profile(); }
@@ -112,10 +123,15 @@ class EasyUnlockServiceTest : public InProcessBrowserTest {
is_bluetooth_adapter_present_ = is_present;
}
+ FakePowerManagerClient* power_manager_client() {
+ return power_manager_client_;
+ }
+
private:
policy::MockConfigurationPolicyProvider provider_;
scoped_refptr<testing::NiceMock<MockBluetoothAdapter> > mock_adapter_;
bool is_bluetooth_adapter_present_;
+ FakePowerManagerClient* power_manager_client_;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockServiceTest);
};
@@ -128,6 +144,16 @@ IN_PROC_BROWSER_TEST_F(EasyUnlockServiceTest, DefaultOn) {
#endif
}
+#if defined(GOOGLE_CHROME_BUILD)
+IN_PROC_BROWSER_TEST_F(EasyUnlockServiceTest, UnloadsOnSuspend) {
+ EXPECT_TRUE(HasEasyUnlockApp());
+ power_manager_client()->SendSuspendImminent();
+ EXPECT_FALSE(HasEasyUnlockApp());
+ power_manager_client()->SendSuspendDone();
+ EXPECT_TRUE(HasEasyUnlockApp());
+}
+#endif
+
class EasyUnlockServiceNoBluetoothTest : public EasyUnlockServiceTest {
public:
EasyUnlockServiceNoBluetoothTest() {}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698