autotest: move more X code to graphics_utils.

Move xrandr to graphics_utils.
Also add assert to functions that are still setting DISPLAY etc.

BUG=chromium:413127, chromium:422414
TEST=Check that output from command below looks reasonable.
     test_that link_freon|nyan_big hardware_Resolution hardware_Xrandr
     hardware_ch7036 power_BacklightControl platform_EvdevSynDropTest
     hardware_TouchScreenPowerCycles hardware_VideoDecodeCapable
     hardware_Trackpad

Change-Id: I029b706bec7d4e7a1d9f904e5f2b0f9e8d7fb193
Reviewed-on: https://chromium-review.googlesource.com/223632
Tested-by: Ilja Friedel <ihf@chromium.org>
Reviewed-by: Haixia Shi <hshi@chromium.org>
Commit-Queue: Ilja Friedel <ihf@chromium.org>
diff --git a/client/common_lib/cros/chromedriver.py b/client/common_lib/cros/chromedriver.py
index 61e94de..23ca0d2 100644
--- a/client/common_lib/cros/chromedriver.py
+++ b/client/common_lib/cros/chromedriver.py
@@ -15,7 +15,6 @@
     logging.error('selenium module failed to be imported.')
     pass
 
-import common
 from autotest_lib.client.bin import utils
 from autotest_lib.client.common_lib.cros import chrome
 
@@ -130,6 +129,7 @@
 
         # Chromedriver will look for an X server running on the display
         # specified through the DISPLAY environment variable.
+        utils.assert_has_X_server()
         os.environ['DISPLAY'] = X_SERVER_DISPLAY
         os.environ['XAUTHORITY'] = X_AUTHORITY