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 crx_file_path = os.path.abspath( |
| 193 os.path.join(self.DataDir(), 'extensions', 'adblock.crx')) |
| 194 ext_id = self.InstallExtension(crx_file_path, False); |
| 195 self.assertTrue(ext_id, msg='Failed to install extension.') |
| 196 |
| 197 self.RestartBrowser(clear_profile=False) |
| 198 extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id) |
| 199 self.assertTrue(extension['is_enabled']) |
| 200 self.assertFalse(extension['allowed_in_incognito']) |
| 201 |
188 | 202 |
189 if __name__ == '__main__': | 203 if __name__ == '__main__': |
190 pyauto_functional.Main() | 204 pyauto_functional.Main() |
OLD | NEW |