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

Unified Diff: client/cros/cros_ui_test.py

Issue 6880288: [autotest] Add test for the re-taking of ownership after the owner key is lost (Closed) Base URL: http://git.chromium.org/git/autotest.git@master
Patch Set: improve comment Created 9 years, 8 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
« no previous file with comments | « client/cros/cros_ownership_test.py ('k') | client/cros/login.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/cros/cros_ui_test.py
diff --git a/client/cros/cros_ui_test.py b/client/cros/cros_ui_test.py
index 9c92d1f4ac342846162416aed67b8e2d906fe45c..917f316f6037871515520c2c7c7c2ec0eddd646b 100644
--- a/client/cros/cros_ui_test.py
+++ b/client/cros/cros_ui_test.py
@@ -201,14 +201,12 @@ class UITest(test.test):
"""Fake ownership by generating the necessary magic files."""
# Determine the module directory.
dirname = os.path.dirname(__file__)
- mock_certfile = os.path.join(dirname, 'mock_owner_cert.pem')
- mock_signedprefsfile = os.path.join(dirname, 'mock_owner.preferences')
- mock_signedpolicyfile = os.path.join(dirname, 'mock_owner.policy')
+ mock_certfile = os.path.join(dirname, constants.MOCK_OWNER_CERT)
+ mock_signedpolicyfile = os.path.join(dirname,
+ constants.MOCK_OWNER_POLICY)
utils.open_write_close(
constants.OWNER_KEY_FILE,
ownership.cert_extract_pubkey_der(mock_certfile))
- shutil.copy(mock_signedprefsfile,
- constants.SIGNED_PREFERENCES_FILE)
shutil.copy(mock_signedpolicyfile,
constants.SIGNED_POLICY_FILE)
@@ -311,6 +309,29 @@ class UITest(test.test):
return cros_ui.get_autox()
+ def validate_basic_policy(self, basic_policy):
+ # Pull in protobuf definitions.
+ sys.path.append(self.srcdir)
+ from device_management_backend_pb2 import PolicyFetchResponse
+ from device_management_backend_pb2 import PolicyData
+ from chrome_device_policy_pb2 import ChromeDeviceSettingsProto
+ from chrome_device_policy_pb2 import UserWhitelistProto
+
+ response_proto = PolicyFetchResponse()
+ response_proto.ParseFromString(basic_policy)
+ ownership.assert_has_policy_data(response_proto)
+
+ poldata = PolicyData()
+ poldata.ParseFromString(response_proto.policy_data)
+ ownership.assert_has_device_settings(poldata)
+ ownership.assert_username(poldata, self.username)
+
+ polval = ChromeDeviceSettingsProto()
+ polval.ParseFromString(poldata.policy_value)
+ ownership.assert_new_users(polval, True)
+ ownership.assert_users_on_whitelist(polval, (self.username,))
+
+
def stop_authserver(self):
"""Tears down fake dns and fake Google Accounts server. If your
subclass does not create these objects, you will want to override this
« no previous file with comments | « client/cros/cros_ownership_test.py ('k') | client/cros/login.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698