Use guest login for DUT test environment.
Guest login does not own TPM; while test user login will own TPM and
cause problem to verify_tpm in finalize.
BUG=chrome-os-partner:22050
TEST=make lint test
TEST=manually on my DUT
Change-Id: I66478977fd95b41278e559f0b03e4f183a0b4e7b
Reviewed-on: https://chromium-review.googlesource.com/171700
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Commit-Queue: Ricky Liang <jcliang@chromium.org>
Tested-by: Ricky Liang <jcliang@chromium.org>
diff --git a/py/goofy/goofy.py b/py/goofy/goofy.py
index 632cece..7d7420c 100755
--- a/py/goofy/goofy.py
+++ b/py/goofy/goofy.py
@@ -1223,6 +1223,9 @@
parser.add_option('--automation', dest='automation',
action='store_true',
help='Enable automation on running factory test')
+ parser.add_option('--test_login', dest='test_login',
+ action='store_true',
+ help='Log in with the test user. This will own the TPM.')
(self.options, self.args) = parser.parse_args(args)
# Make sure factory directories exist.
@@ -1261,7 +1264,8 @@
logging.warn(
'Using chroot environment: will not actually run autotests')
else:
- self.env = test_environment.DUTEnvironment()
+ self.env = test_environment.DUTEnvironment(
+ test_login=self.options.test_login)
self.env.goofy = self
if self.options.restart:
diff --git a/py/goofy/test_environment.py b/py/goofy/test_environment.py
index 5213d0d..5a0df61 100644
--- a/py/goofy/test_environment.py
+++ b/py/goofy/test_environment.py
@@ -75,12 +75,17 @@
'''
A real environment on a device under test.
'''
- BROWSER_TYPE = 'system'
+ BROWSER_TYPE_LOGIN = 'system'
+ BROWSER_TYPE_GUEST = 'system-guest'
EXTENSION_PATH = os.path.join(factory.FACTORY_PATH, 'py', 'goofy',
'factory_test_extension')
- def __init__(self):
+ def __init__(self, test_login):
self.browser = None
self.extension = None
+ if test_login:
+ self.browser_type = self.BROWSER_TYPE_LOGIN
+ else:
+ self.browser_type = self.BROWSER_TYPE_GUEST
def shutdown(self, operation):
assert operation in ['reboot', 'halt']
@@ -108,10 +113,11 @@
while tries_left:
try:
finder_options = browser_options.BrowserFinderOptions()
- finder_options.browser_type = self.BROWSER_TYPE
- self.extension = extension_to_load.ExtensionToLoad(
- self.EXTENSION_PATH, self.BROWSER_TYPE, is_component=True)
- finder_options.extensions_to_load.append(self.extension)
+ finder_options.browser_type = self.browser_type
+ if self.browser_type == self.BROWSER_TYPE_LOGIN:
+ self.extension = extension_to_load.ExtensionToLoad(
+ self.EXTENSION_PATH, self.browser_type, is_component=True)
+ finder_options.extensions_to_load.append(self.extension)
finder_options.AppendExtraBrowserArgs([
'--kiosk',
'--kiosk-mode-screensaver-path=/dev/null',