OLD | NEW |
---|---|
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 """ | 6 """ |
7 This module is a simple qa tool that installs extensions and tests whether the | 7 This module is a simple qa tool that installs extensions and tests whether the |
8 browser crashes while visiting a list of urls. | 8 browser crashes while visiting a list of urls. |
9 | 9 |
10 Usage: python extensions.py -v | 10 Usage: python extensions.py -v |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 # Allow extension in incognito mode and verify. | 178 # Allow extension in incognito mode and verify. |
179 self.SetExtensionStateById(ext_id, enable=True, allow_in_incognito=True) | 179 self.SetExtensionStateById(ext_id, enable=True, allow_in_incognito=True) |
180 extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id) | 180 extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id) |
181 self.assertTrue(extension['allowed_in_incognito']) | 181 self.assertTrue(extension['allowed_in_incognito']) |
182 | 182 |
183 # Disallow extension in incognito mode and verify. | 183 # Disallow extension in incognito mode and verify. |
184 self.SetExtensionStateById(ext_id, enable=True, allow_in_incognito=False) | 184 self.SetExtensionStateById(ext_id, enable=True, allow_in_incognito=False) |
185 extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id) | 185 extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id) |
186 self.assertFalse(extension['allowed_in_incognito']) | 186 self.assertFalse(extension['allowed_in_incognito']) |
187 | 187 |
188 def testAdblockExtensionCrash(self): | |
189 """Test AdBlock extension successfully installed and enabled, and do not | |
190 cause browser crash. | |
191 """ | |
192 # TODO: need to make pyauto test accept arguments. | |
Nirnimesh
2011/08/31 08:28:55
Remove the TODO. The test looks fine without it.
vivianz
2011/08/31 21:20:16
Done.
| |
193 crx_file_path = os.path.abspath( | |
194 os.path.join(self.DataDir(), 'extensions', 'adblock.crx')) | |
195 ext_id = self.InstallExtension(pyauto.FilePath(crx_file_path), False); | |
196 self.assertTrue(ext_id, 'Failed to install extension.') | |
Nirnimesh
2011/08/31 08:28:55
msg='Failed to install extension'
vivianz
2011/08/31 21:20:16
Done.
| |
197 | |
198 self.RestartBrowser(clear_profile=False) | |
199 extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id) | |
200 self.assertTrue(extension['is_enabled']) | |
201 self.assertFalse(extension['allowed_in_incognito']) | |
188 | 202 |
203 | |
189 if __name__ == '__main__': | 204 if __name__ == '__main__': |
190 pyauto_functional.Main() | 205 pyauto_functional.Main() |
OLD | NEW |