Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # 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 |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Chromoting helper to install/uninstall host and replace pref pane.""" | 5 """Chromoting helper to install/uninstall host and replace pref pane.""" |
| 6 | 6 |
| 7 import abc | 7 import abc |
| 8 import os | 8 import os |
| 9 import shutil | 9 import shutil |
| 10 import sys | 10 import sys |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 subprocess.call([uninstall_app, '--no-ui']) | 117 subprocess.call([uninstall_app, '--no-ui']) |
| 118 | 118 |
| 119 def ReplacePrefPaneMac(self, operation): | 119 def ReplacePrefPaneMac(self, operation): |
| 120 """Constructs mock pref pane to replace the actual pref pane on Mac.""" | 120 """Constructs mock pref pane to replace the actual pref pane on Mac.""" |
| 121 assert os.geteuid() == 0, 'Need superuser privileges' | 121 assert os.geteuid() == 0, 'Need superuser privileges' |
| 122 | 122 |
| 123 pref_pane_dir = os.path.join('/Library', 'PreferencePanes') | 123 pref_pane_dir = os.path.join('/Library', 'PreferencePanes') |
| 124 | 124 |
| 125 mock_pref_pane = os.path.join(pref_pane_dir, 'mock_pref_pane') | 125 mock_pref_pane = os.path.join(pref_pane_dir, 'mock_pref_pane') |
| 126 pref_pane = os.path.join(pref_pane_dir, | 126 pref_pane = os.path.join(pref_pane_dir, |
| 127 'org.chromium.chromoting.prefPane') | 127 'ChromeRemoteDesktop.prefPane') |
|
Sergey Ulanov
2014/03/25 07:48:45
pyauto tests are on death row - is it worth updati
| |
| 128 mock_pref_pane_python = os.path.join( | 128 mock_pref_pane_python = os.path.join( |
| 129 os.path.dirname(os.path.abspath(__file__)), | 129 os.path.dirname(os.path.abspath(__file__)), |
| 130 'mock_pref_pane.py') | 130 'mock_pref_pane.py') |
| 131 | 131 |
| 132 # When the symlink from real pref pane to mock pref pane exists, | 132 # When the symlink from real pref pane to mock pref pane exists, |
| 133 # mock pref pane will be modified to be a dir when the host is installed. | 133 # mock pref pane will be modified to be a dir when the host is installed. |
| 134 # After the host is installed and mock pref pane is modified to be a file, | 134 # After the host is installed and mock pref pane is modified to be a file, |
| 135 # it will be a file until next host installation. | 135 # it will be a file until next host installation. |
| 136 if os.path.isdir(mock_pref_pane): | 136 if os.path.isdir(mock_pref_pane): |
| 137 shutil.rmtree(mock_pref_pane, True) | 137 shutil.rmtree(mock_pref_pane, True) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 elif sys.argv[1] in ['enable', 'disable', 'changepin']: | 190 elif sys.argv[1] in ['enable', 'disable', 'changepin']: |
| 191 assert sys.platform.startswith('darwin'), \ | 191 assert sys.platform.startswith('darwin'), \ |
| 192 'Replacing pref pane is Mac specific' | 192 'Replacing pref pane is Mac specific' |
| 193 helper.ReplacePrefPaneMac(sys.argv[1]) | 193 helper.ReplacePrefPaneMac(sys.argv[1]) |
| 194 else: | 194 else: |
| 195 print >>sys.stderr, 'Invalid syntax' | 195 print >>sys.stderr, 'Invalid syntax' |
| 196 return 1 | 196 return 1 |
| 197 | 197 |
| 198 | 198 |
| 199 if __name__ == '__main__': | 199 if __name__ == '__main__': |
| 200 Main() | 200 Main() |
| OLD | NEW |