Add new experimental BVT test login_CryptohomeMountedTelemetry.
This test uses Telemetry-based login instead of PyAuto-based login
(PyAuto is used by existing BVT test login_CryptohomeMounted). Once
the Telemetry-based version is deemed reliable enough, it will
replace the PyAuto-based version.
This change must land along with a corresponding change that adds
login_CryptohomeMountedTelemetry to the autotest-chrome ebuild.
CQ-DEPEND=CL:59599
BUG=chromium:236453
TEST=cbuildbot --remote --hwtest --chrome_rev=tot -g '59599 59601' lumpy-release
Change-Id: I701d89c5fb7de31eae333e617def914993c27dd3
Reviewed-on: https://gerrit.chromium.org/gerrit/59601
Commit-Queue: Dennis Jeffrey <dennisjeffrey@chromium.org>
Reviewed-by: Dennis Jeffrey <dennisjeffrey@chromium.org>
Tested-by: Dennis Jeffrey <dennisjeffrey@chromium.org>
diff --git a/client/common_lib/cros/chrome.py b/client/common_lib/cros/chrome.py
new file mode 100644
index 0000000..c9055ee
--- /dev/null
+++ b/client/common_lib/cros/chrome.py
@@ -0,0 +1,33 @@
+# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Telemetry-based Chrome automation functions."""
+
+from telemetry.core import browser_finder, browser_options
+
+
+# The following constant is the name of the logged-in user that is specified
+# by the Telemetry chromeOS login extension
+# (chromium/src/tools/telemetry/telemetry/core/chrome/chromeos_login_ext).
+# The value here must match what is specified in that login extension.
+LOGIN_USER = 'test@test.test'
+
+
+def login():
+ """Logs into Chrome.
+
+ Wrapping this within a Python with/as construct will take care of
+ automatically logging into Chrome at the start and logging out of Chrome
+ at the end, e.g.:
+
+ with chrome.login() as chrome_obj:
+ do_test() # Will be logged in for this.
+ # Logged out at this point.
+
+ @return A Telemetry Browser object supporting context management.
+ """
+ default_options = browser_options.BrowserOptions()
+ default_options.browser_type = 'system'
+ browser_to_create = browser_finder.FindBrowser(default_options)
+ return browser_to_create.Create()