| OLD | NEW |
| 1 #!/usr/bin/python | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 | |
| 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 6 | 4 |
| 7 """Python representation for Chromium Preferences. | 5 """Python representation for Chromium Preferences. |
| 8 | 6 |
| 9 Obtain one of these from a call to PyUITest::GetPrefsInfo() or | 7 Obtain one of these from a call to PyUITest::GetPrefsInfo() or |
| 10 PyUITest::GetLocalStatePrefsInfo(). | 8 PyUITest::GetLocalStatePrefsInfo(). |
| 11 | 9 |
| 12 Example: | 10 Example: |
| 13 class MyTest(pyauto.PyUITest): | 11 class MyTest(pyauto.PyUITest): |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 list or a plain value. | 91 list or a plain value. |
| 94 None, if prefernece for path not found (if path is given). | 92 None, if prefernece for path not found (if path is given). |
| 95 """ | 93 """ |
| 96 all = self.prefsdict.get('prefs', {}) | 94 all = self.prefsdict.get('prefs', {}) |
| 97 if not path: # No path given. Return all prefs. | 95 if not path: # No path given. Return all prefs. |
| 98 return all | 96 return all |
| 99 for part in path.split('.'): # Narrow down to the requested prefs path. | 97 for part in path.split('.'): # Narrow down to the requested prefs path. |
| 100 all = all.get(part) | 98 all = all.get(part) |
| 101 if all is None: return None | 99 if all is None: return None |
| 102 return all | 100 return all |
| OLD | NEW |