Refactor VerifyDevSwitchDisabled.

Also mock Util properly in the unittest.

BUG=None
TEST=manual command on DUT

Change-Id: Ie59fc877575009fc9af14f84eee2ef4db20ac0fe
Reviewed-on: https://gerrit.chromium.org/gerrit/39071
Commit-Ready: Andy Cheng <andycheng@chromium.org>
Reviewed-by: Andy Cheng <andycheng@chromium.org>
Tested-by: Andy Cheng <andycheng@chromium.org>
diff --git a/py/gooftool/gooftool.py b/py/gooftool/gooftool.py
index a2461ad..93b3c9c 100755
--- a/py/gooftool/gooftool.py
+++ b/py/gooftool/gooftool.py
@@ -498,18 +498,9 @@
 def VerifyDevSwitch(options):  # pylint: disable=W0613
   """Verify developer switch is disabled."""
 
-  VBSD_HONOR_VIRT_DEV_SWITCH = 0x400
-  flags = int(Shell('crossystem vdat_flags').stdout.strip(), 0)
-  if (flags & VBSD_HONOR_VIRT_DEV_SWITCH) != 0:
-    # System is using virtual developer switch.  That will be handled in
-    # prepare_wipe.sh by setting "crossystem disable_dev_request=1" -- although
-    # we can't verify that until next reboot, because the real values are stored
-    # in TPM.
+  if Gooftool().CheckDevSwitchForDisabling():
     logging.warn('VerifyDevSwitch: No physical switch.')
     _event_log.Log('switch_dev', type='virtual switch')
-    return
-  if Shell('crossystem devsw_cur').stdout.strip() != '0':
-    raise Error, 'developer mode is not disabled'
 
 
 @Command('write_protect')