- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / functional / chromeos_prefs.py
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import os
7 import sys
8 import time
9
10 import pyauto_functional  # Must be imported before pyauto
11 import pyauto
12
13 sys.path.append('/usr/local')  # Required to import autotest libs
14 from autotest.cros import constants
15
16
17 class ChromeosPrefsTest(pyauto.PyUITest):
18   """TestCase for ChromeOS Preferences."""
19
20   # Defined in src/chrome/browser/chromeos/login/user_manager.cc
21   k_logged_in_users = 'LoggedInUsers'
22   k_user_images = 'UserImages'
23   k_image_path_node_name = 'path'
24
25   def testAllUserImage(self):
26     """Verify changing all available default user images in Change picture."""
27
28     logged_in_user = constants.CREDENTIALS['$default'][0]
29     for i in range(19):
30       image = {
31           "index": i,
32           "path": ""
33       }
34       user_images = {}
35       user_images[logged_in_user] = image
36       self.SetLocalStatePrefs(ChromeosPrefsTest.k_user_images, user_images)
37       self.RestartBrowser(clear_profile=False)
38       current_user_images = self.GetLocalStatePrefsInfo().Prefs(
39           ChromeosPrefsTest.k_user_images)
40       current_image = current_user_images.get(logged_in_user)
41       self.assertEqual(image, current_image,
42                        msg='Default user image was not set in preferences.')
43
44
45 if __name__ == '__main__':
46   pyauto_functional.Main()