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

Side by Side Diff: chrome/test/functional/chromeos_security.py

Issue 7548024: Refactor: Make PyAuto InstallExtension() take a string. Delete dead code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixup per kkania. Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/automation/automation_proxy.cc ('k') | chrome/test/functional/extensions.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 import pprint 7 import pprint
8 8
9 import pyauto_functional 9 import pyauto_functional
10 import pyauto 10 import pyauto
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 self._VerifyExtensionPermissions(self._component_extension_baseline) 163 self._VerifyExtensionPermissions(self._component_extension_baseline)
164 164
165 def testBundledCrxPermissions(self): 165 def testBundledCrxPermissions(self):
166 """Ensures bundled CRX permissions are as expected.""" 166 """Ensures bundled CRX permissions are as expected."""
167 # Verify that each bundled CRX on the device is expected, then install it. 167 # Verify that each bundled CRX on the device is expected, then install it.
168 for file_name in os.listdir(self._bundled_crx_directory): 168 for file_name in os.listdir(self._bundled_crx_directory):
169 if file_name.endswith('.crx'): 169 if file_name.endswith('.crx'):
170 self.assertTrue( 170 self.assertTrue(
171 file_name in [x['crx_file'] for x in self._bundled_crx_baseline], 171 file_name in [x['crx_file'] for x in self._bundled_crx_baseline],
172 msg='Unexpected CRX file: ' + file_name) 172 msg='Unexpected CRX file: ' + file_name)
173 crx_file = pyauto.FilePath( 173 crx_file = os.path.join(self._bundled_crx_directory, file_name)
174 os.path.join(self._bundled_crx_directory, file_name))
175 self.assertTrue(self.InstallExtension(crx_file, False), 174 self.assertTrue(self.InstallExtension(crx_file, False),
176 msg='Extension install failed: %s' % crx_file.value()) 175 msg='Extension install failed: %s' % crx_file)
177 176
178 # Verify that the permissions information in the baseline matches the 177 # Verify that the permissions information in the baseline matches the
179 # permissions associated with the installed bundled CRX extensions. 178 # permissions associated with the installed bundled CRX extensions.
180 self._VerifyExtensionPermissions(self._bundled_crx_baseline) 179 self._VerifyExtensionPermissions(self._bundled_crx_baseline)
181 180
182 def testNoUnexpectedExtensions(self): 181 def testNoUnexpectedExtensions(self):
183 """Ensures there are no unexpected bundled or component extensions.""" 182 """Ensures there are no unexpected bundled or component extensions."""
184 # Install all bundled extensions on the device. 183 # Install all bundled extensions on the device.
185 for file_name in os.listdir(self._bundled_crx_directory): 184 for file_name in os.listdir(self._bundled_crx_directory):
186 if file_name.endswith('.crx'): 185 if file_name.endswith('.crx'):
187 crx_file = pyauto.FilePath( 186 crx_file = os.path.join(self._bundled_crx_directory, file_name)
188 os.path.join(self._bundled_crx_directory, file_name))
189 self.assertTrue(self.InstallExtension(crx_file, False), 187 self.assertTrue(self.InstallExtension(crx_file, False),
190 msg='Extension install failed: %s' % crx_file.value()) 188 msg='Extension install failed: %s' % crx_file)
191 189
192 # Ensure that the set of installed extension names precisely matches the 190 # Ensure that the set of installed extension names precisely matches the
193 # baseline. 191 # baseline.
194 expected_names = [ext['name'] for ext in self._component_extension_baseline] 192 expected_names = [ext['name'] for ext in self._component_extension_baseline]
195 expected_names.extend([ext['name'] for ext in self._bundled_crx_baseline]) 193 expected_names.extend([ext['name'] for ext in self._bundled_crx_baseline])
196 ext_actual_info = self.GetExtensionsInfo() 194 ext_actual_info = self.GetExtensionsInfo()
197 installed_names = [ext['name'] for ext in ext_actual_info] 195 installed_names = [ext['name'] for ext in ext_actual_info]
198 self._AssertExtensionNamesAreExpected( 196 self._AssertExtensionNamesAreExpected(
199 set(expected_names), set(installed_names), 'Installed extension', 197 set(expected_names), set(installed_names), 'Installed extension',
200 self._component_extension_baseline + self._bundled_crx_baseline, 198 self._component_extension_baseline + self._bundled_crx_baseline,
201 ext_actual_info) 199 ext_actual_info)
202 200
203 201
204 if __name__ == '__main__': 202 if __name__ == '__main__':
205 pyauto_functional.Main() 203 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/automation/automation_proxy.cc ('k') | chrome/test/functional/extensions.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698