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

Unified Diff: device/power_save_blocker/power_save_blocker_x11.cc

Issue 2883903002: Add service unittest for WakeLockServiceImpl. (Closed)
Patch Set: Addressed Colin's review comments Created 3 years, 7 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
Index: device/power_save_blocker/power_save_blocker_x11.cc
diff --git a/device/power_save_blocker/power_save_blocker_x11.cc b/device/power_save_blocker/power_save_blocker_x11.cc
index 8c96590eaab5f29bf88ce0662560af775c9dc893..3a77287647b1d7fa0440202d1cd5e807e8bd8e3f 100644
--- a/device/power_save_blocker/power_save_blocker_x11.cc
+++ b/device/power_save_blocker/power_save_blocker_x11.cc
@@ -441,6 +441,10 @@ bool PowerSaveBlocker::Delegate::XSSAvailable() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless))
return false;
XDisplay* display = gfx::GetXDisplay();
+ // In service_unittests context, XDisplay is not well initialized. passing a
+ // nullptr to XScreenSaverQueryExtension() will cause crash.
scottmg 2017/05/17 16:00:32 nit; if we keep this, a more natural phrasing:
ke.he 2017/05/19 03:46:51 Done.
+ if (!display)
+ return false;
scottmg 2017/05/17 16:00:32 Could you recheck this? At the top of WakeLockServ
int dummy;
scottmg 2017/05/17 16:00:32 nit; Add a blank line before int dummy;.
ke.he 2017/05/19 03:46:51 Done.
int major;
int minor;
« no previous file with comments | « no previous file | services/device/BUILD.gn » ('j') | services/device/wake_lock/wake_lock_service_impl_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698