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

Unified Diff: chrome/browser/chromeos/login/hid_detection_browsertest.cc

Issue 2482463002: Remove DeviceMonitorLinux::WillDestroyCurrentMessageLoop(). (Closed)
Patch Set: CR achuithb #24 Created 4 years, 1 month 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
Index: chrome/browser/chromeos/login/hid_detection_browsertest.cc
diff --git a/chrome/browser/chromeos/login/hid_detection_browsertest.cc b/chrome/browser/chromeos/login/hid_detection_browsertest.cc
index 44392fe2ce66cf2dd04f88233934ebf9ca471adc..ff50f9a4e997ffbab0f104328fe3efaa51773687 100644
--- a/chrome/browser/chromeos/login/hid_detection_browsertest.cc
+++ b/chrome/browser/chromeos/login/hid_detection_browsertest.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/chromeos/login/test/oobe_base_test.h"
@@ -57,8 +58,8 @@ class HidDetectionTest : public OobeBaseTest {
~HidDetectionTest() override {}
void InitInputService() {
- input_service_linux_.reset(new device::FakeInputServiceLinux);
- InputServiceLinux::SetForTesting(input_service_linux_.get());
+ InputServiceLinux::SetForTesting(
+ base::MakeUnique<device::FakeInputServiceLinux>());
}
void SetUpOnMainThread() override {
@@ -78,8 +79,7 @@ class HidDetectionTest : public OobeBaseTest {
mouse.subsystem = InputDeviceInfo::SUBSYSTEM_INPUT;
mouse.type = InputDeviceInfo::TYPE_USB;
mouse.is_mouse = true;
- LOG(ERROR) << input_service_linux_.get();
- input_service_linux_->AddDeviceForTesting(mouse);
+ AddDeviceForTesting(mouse);
}
void AddUsbKeyboard(const std::string& keyboard_id) {
@@ -88,15 +88,19 @@ class HidDetectionTest : public OobeBaseTest {
keyboard.subsystem = InputDeviceInfo::SUBSYSTEM_INPUT;
keyboard.type = InputDeviceInfo::TYPE_USB;
keyboard.is_keyboard = true;
- input_service_linux_->AddDeviceForTesting(keyboard);
+ AddDeviceForTesting(keyboard);
}
private:
+ void AddDeviceForTesting(const InputDeviceInfo& info) {
+ static_cast<device::FakeInputServiceLinux*>(
+ device::InputServiceLinux::GetInstance())
+ ->AddDeviceForTesting(info);
+ }
+
scoped_refptr<
testing::NiceMock<device::MockBluetoothAdapter> > mock_adapter_;
- std::unique_ptr<device::FakeInputServiceLinux> input_service_linux_;
-
base::WeakPtrFactory<HidDetectionTest> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(HidDetectionTest);
« no previous file with comments | « chrome/browser/chromeos/login/bluetooth_host_pairing_browsertest.cc ('k') | device/base/device_monitor_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698