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

Unified Diff: chrome/test/functional/chromeos_prefs.py

Issue 7523063: Add a hook for capturing a user profile photo and saving it to file and local state. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased Created 9 years, 5 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 | « chrome/browser/chromeos/options/take_photo_dialog.cc ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/chromeos_prefs.py
diff --git a/chrome/test/functional/chromeos_prefs.py b/chrome/test/functional/chromeos_prefs.py
index 69244042f4facf267a909e57e70ff10fd82af544..cb786768c4c585bdfad9ab0fef2868a4d2a9a09f 100644
--- a/chrome/test/functional/chromeos_prefs.py
+++ b/chrome/test/functional/chromeos_prefs.py
@@ -3,6 +3,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import os
+import time
+
import pyauto_functional # Must be imported before pyauto
import pyauto
@@ -10,28 +13,55 @@ import pyauto
class ChromeosPrefsTest(pyauto.PyUITest):
"""TestCase for ChromeOS Preferences."""
+ # Defined in src/chrome/browser/chromeos/login/user_manager.cc
+ k_logged_in_users = 'LoggedInUsers'
+ k_user_images = 'UserImages'
+
def testDefaultUserImage(self):
"""Verify changing default user image prefs work."""
- # Defined in src/chrome/browser/chromeos/login/user_manager.cc
- k_logged_in_users = 'LoggedInUsers'
- k_user_images = 'UserImages'
# Defined in src/chrome/browser/chromeos/login/default_user_images.cc
image1 = u'default:4'
image2 = u'default:5'
for image in image1, image2:
logged_in_user = \
- self.GetLocalStatePrefsInfo().Prefs(k_logged_in_users)[0]
+ self.GetLocalStatePrefsInfo().Prefs(
+ ChromeosPrefsTest.k_logged_in_users)[0]
user_images = {}
user_images[logged_in_user] = image
- self.SetLocalStatePrefs(k_user_images, user_images)
+ self.SetLocalStatePrefs( ChromeosPrefsTest.k_user_images, user_images)
self.RestartBrowser(clear_profile=False)
- current_user_images = self.GetLocalStatePrefsInfo().Prefs(k_user_images)
+ current_user_images = self.GetLocalStatePrefsInfo().Prefs(
+ ChromeosPrefsTest.k_user_images)
current_image = current_user_images.get(logged_in_user)
- self.assertEqual(image, current_image)
+ self.assertEqual(image, current_image,
+ msg='Default user image was not set in preferences.')
+
+ def testCaptureUserPhoto(self):
+ """Verify capturing/saving user photo works."""
+
+ logged_in_user = \
+ self.GetLocalStatePrefsInfo().Prefs(
+ ChromeosPrefsTest.k_logged_in_users)[0]
+ # Defined in src/chrome/browser/chromeos/login/user_manager.cc
+ expected_photo_name = logged_in_user + '.png'
+
+ self.CaptureProfilePhoto()
+
+ for i in range(2):
+ current_user_images = self.GetLocalStatePrefsInfo().Prefs(
+ ChromeosPrefsTest.k_user_images)
+ current_image_path = current_user_images.get(logged_in_user)
+ self.assertTrue(expected_photo_name in current_image_path,
+ msg='Captured user photo was not set in preferences.')
+ self.assertTrue(os.path.isfile(current_image_path),
+ msg='Image file was not saved.') and \
+ self.assertTrue(os.path.getsize(current_image_path) > 1000,
+ msg='Image file may not be valid.' )
+ if not i:
+ self.RestartBrowser(clear_profile=False)
if __name__ == '__main__':
pyauto_functional.Main()
-
« no previous file with comments | « chrome/browser/chromeos/options/take_photo_dialog.cc ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698