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

Unified Diff: chrome/test/pyautolib/pyauto.py

Issue 10408072: Rewrite of the EnrollEnterpriseDevice PyAuto automation hook for WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed nits. Created 8 years, 7 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
Index: chrome/test/pyautolib/pyauto.py
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index 45c97c35022cdb8181ca029ea48bf43d3b0bc1e0..c83dee4c0a763d2c7022583815487de6e2fcae12 100755
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -85,6 +85,7 @@ import omnibox_info
import plugins_info
import prefs_info
from pyauto_errors import JSONInterfaceError
+from pyauto_errors import EnrollmentError
from pyauto_errors import NTPThumbnailNotShownError
import pyauto_utils
import simplejson as json # found in third_party
@@ -4911,21 +4912,21 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
equivalent to pressing Ctrl-Alt-e to enroll the device from the login
screen.
- Returns:
- An error string if the enrollment fails.
- None otherwise.
-
Raises:
pyauto_errors.JSONInterfaceError if the automation call returns an error.
- """
- cmd_dict = {
- 'command': 'EnrollEnterpriseDevice',
- 'user': user,
- 'password': password,
- }
- time.sleep(5) # TODO(craigdh): Block until Install Attributes is ready.
- result = self._GetResultFromJSONRequest(cmd_dict, windex=None)
- return result.get('error_string')
+ pyauto_errors.EnrollmentError if the enrollment fails.
+ """
+ self._GetResultFromJSONRequest(
+ {'command': 'ShowEnterpriseWizard'}, windex=None)
+ observer_id = self._GetResultFromJSONRequest(
+ {'command': 'AddEnrollmentObserver'}, windex=None)['observer_id']
+ self.ExecuteJavascriptInOOBEWebUI("""
+ chrome.send("oauthEnrollCompleteLogin", ["%s", "%s"] );
+ window.domAutomationController.send("success");""" %
+ (user, password));
+ response = self.GetNextEvent(observer_id)
+ if 'error_string' in response:
+ raise EnrollmentError(response['error_string'])
def GetUpdateInfo(self):
"""Gets the status of the ChromeOS updater.

Powered by Google App Engine
This is Rietveld 408576698