| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 self.TriggerBrowserActionById(ext_id) | 193 self.TriggerBrowserActionById(ext_id) |
| 194 | 194 |
| 195 # Verify that the browser action turned the background red. | 195 # Verify that the browser action turned the background red. |
| 196 self.assertTrue(self.WaitUntil( | 196 self.assertTrue(self.WaitUntil( |
| 197 lambda: self.GetDOMValue('document.body.style.backgroundColor'), | 197 lambda: self.GetDOMValue('document.body.style.backgroundColor'), |
| 198 expect_retval='red'), | 198 expect_retval='red'), |
| 199 msg='Browser action was not triggered.') | 199 msg='Browser action was not triggered.') |
| 200 | 200 |
| 201 def testTriggerBrowserActionWithPopup(self): | 201 def testTriggerBrowserActionWithPopup(self): |
| 202 """Test triggering browser action that shows a popup.""" | 202 """Test triggering browser action that shows a popup.""" |
| 203 # Fails on Vista Chromium bot only. crbug.com/106620 |
| 204 if (self.IsWinVista() and |
| 205 self.GetBrowserInfo()['properties']['branding'] == 'Chromium'): |
| 206 return |
| 203 dir_path = os.path.abspath( | 207 dir_path = os.path.abspath( |
| 204 os.path.join(self.DataDir(), 'extensions', 'trigger_actions', | 208 os.path.join(self.DataDir(), 'extensions', 'trigger_actions', |
| 205 'browser_action_popup')) | 209 'browser_action_popup')) |
| 206 ext_id = self.InstallExtension(dir_path) | 210 ext_id = self.InstallExtension(dir_path) |
| 207 | 211 |
| 208 self.TriggerBrowserActionById(ext_id) | 212 self.TriggerBrowserActionById(ext_id) |
| 209 | 213 |
| 210 # Verify that the extension popup is displayed. | 214 # Verify that the extension popup is displayed. |
| 211 popup = self.WaitUntilExtensionViewLoaded( | 215 popup = self.WaitUntilExtensionViewLoaded( |
| 212 view_type='EXTENSION_POPUP') | 216 view_type='EXTENSION_POPUP') |
| (...skipping 20 matching lines...) Expand all Loading... |
| 233 self.TriggerPageActionById(ext_id) | 237 self.TriggerPageActionById(ext_id) |
| 234 | 238 |
| 235 # Verify that page action turned the background red. | 239 # Verify that page action turned the background red. |
| 236 self.assertTrue(self.WaitUntil( | 240 self.assertTrue(self.WaitUntil( |
| 237 lambda: self.GetDOMValue('document.body.style.backgroundColor'), | 241 lambda: self.GetDOMValue('document.body.style.backgroundColor'), |
| 238 expect_retval='red'), | 242 expect_retval='red'), |
| 239 msg='Page action was not triggered.') | 243 msg='Page action was not triggered.') |
| 240 | 244 |
| 241 def testTriggerPageActionWithPopup(self): | 245 def testTriggerPageActionWithPopup(self): |
| 242 """Test triggering page action that shows a popup.""" | 246 """Test triggering page action that shows a popup.""" |
| 247 # Fails on Vista Chromium bot only. crbug.com/106620 |
| 248 if (self.IsWinVista() and |
| 249 self.GetBrowserInfo()['properties']['branding'] == 'Chromium'): |
| 250 return |
| 243 dir_path = os.path.abspath( | 251 dir_path = os.path.abspath( |
| 244 os.path.join(self.DataDir(), 'extensions', 'trigger_actions', | 252 os.path.join(self.DataDir(), 'extensions', 'trigger_actions', |
| 245 'page_action_popup')) | 253 'page_action_popup')) |
| 246 ext_id = self.InstallExtension(dir_path) | 254 ext_id = self.InstallExtension(dir_path) |
| 247 | 255 |
| 248 # Page action icon is displayed when a tab is created. | 256 # Page action icon is displayed when a tab is created. |
| 249 self.AppendTab(pyauto.GURL('chrome://newtab')) | 257 self.AppendTab(pyauto.GURL('chrome://newtab')) |
| 250 self.ActivateTab(0) | 258 self.ActivateTab(0) |
| 251 self.assertTrue(self.WaitUntil( | 259 self.assertTrue(self.WaitUntil( |
| 252 lambda: ext_id in | 260 lambda: ext_id in |
| (...skipping 18 matching lines...) Expand all Loading... |
| 271 ext_id = self.InstallExtension(crx_file_path) | 279 ext_id = self.InstallExtension(crx_file_path) |
| 272 | 280 |
| 273 self.RestartBrowser(clear_profile=False) | 281 self.RestartBrowser(clear_profile=False) |
| 274 extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id) | 282 extension = self._GetExtensionInfoById(self.GetExtensionsInfo(), ext_id) |
| 275 self.assertTrue(extension['is_enabled']) | 283 self.assertTrue(extension['is_enabled']) |
| 276 self.assertFalse(extension['allowed_in_incognito']) | 284 self.assertFalse(extension['allowed_in_incognito']) |
| 277 | 285 |
| 278 | 286 |
| 279 if __name__ == '__main__': | 287 if __name__ == '__main__': |
| 280 pyauto_functional.Main() | 288 pyauto_functional.Main() |
| OLD | NEW |