summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-01 18:28:17 +0000
committernirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-01 18:28:17 +0000
commit2218d3a81441e898c03172506cd9200f91bbcfbe (patch)
treebd90bfc1438e09c2a2cbf43a43d7e5f60e74a8f8
parente97b25c21c29373be42c47fe708e4f8c7be6c7b7 (diff)
downloadchromium_src-2218d3a81441e898c03172506cd9200f91bbcfbe.zip
chromium_src-2218d3a81441e898c03172506cd9200f91bbcfbe.tar.gz
chromium_src-2218d3a81441e898c03172506cd9200f91bbcfbe.tar.bz2
[chromeos] Fix Logout() automation on chromeos to not clear /home/chronos
Logout() used to clear off /home/chronos and /home/chronos/user while re-initializing the automation channel. This is wrong. Make it not do so. Add a test to verify that profile and files in /home/chronos & /home/chronos/user persist across 2 login sessions of the same account. R=ivankr@chromium.org BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10441136 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140063 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xchrome/test/functional/chromeos_login.py28
-rwxr-xr-xchrome/test/pyautolib/pyauto.py5
2 files changed, 33 insertions, 0 deletions
diff --git a/chrome/test/functional/chromeos_login.py b/chrome/test/functional/chromeos_login.py
index 3925ba7..7140dde 100755
--- a/chrome/test/functional/chromeos_login.py
+++ b/chrome/test/functional/chromeos_login.py
@@ -193,6 +193,34 @@ class ChromeosLogin(pyauto.PyUITest):
self.assertFalse(info['windows'][1]['incognito'],
msg='Expected a regular new window.')
+ def testProfilePreservedBetweenLogins(self):
+ """Verify that profile is preserved between two login sessions.
+
+ Also verify Local State.
+ """
+ self.testGoodLogin()
+
+ # Build up some history and setup state in "Local State".
+ url = self.GetHttpURLForDataPath('title2.html')
+ self.NavigateToURL(url)
+ open('/home/chronos/__magic__', 'w').close()
+ open('/home/chronos/user/__magic__', 'w').close()
+
+ def _VerifyProfile():
+ history = self.GetHistoryInfo().History()
+ self.assertEqual(1, len(history))
+ self.assertEqual(url, history[0]['url'])
+ self.assertTrue(os.path.exists('/home/chronos/__magic__'),
+ msg='/home/chronos/__magic__ did not persist across login sessions')
+ self.assertTrue(os.path.exists('/home/chronos/user/__magic__'),
+ msg='/home/chronos/user/__magic__ did not persist across '
+ 'login sessions')
+
+ _VerifyProfile()
+ self.Logout()
+ self.testGoodLogin() # Re-login with same account.
+ _VerifyProfile()
+
if __name__ == '__main__':
pyauto_functional.Main()
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index 97b1ba3..89cfe98 100755
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -427,6 +427,8 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
def CleanupBrowserProfileOnChromeOS():
"""Cleanup browser profile dir on ChromeOS.
+ This does not clear cryptohome.
+
Browser should not be running, or else there will be locked files.
"""
profile_dir = '/home/chronos/user'
@@ -4160,6 +4162,8 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
Should be logged in to work. Re-initializes the automation channel
after logout.
"""
+ clear_profile_orig = self.get_clear_profile()
+ self.set_clear_profile(False)
assert self.GetLoginInfo()['is_logged_in'], \
'Trying to log out when already logged out.'
def _SignOut():
@@ -4168,6 +4172,7 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
assert self.WaitForSessionManagerRestart(_SignOut), \
'Session manager did not restart after logout.'
self.__SetUp()
+ self.set_clear_profile(clear_profile_orig)
def LockScreen(self):
"""Locks the screen on chromeos.