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

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

Issue 10825006: Update pyauto tests to use content/test/data/plugin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/functional/flash.py ('k') | chrome/test/functional/plugins.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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 logging 6 import logging
7 import os 7 import os
8 import re 8 import re
9 9
10 import pyauto_functional # Must be imported before pyauto 10 import pyauto_functional # Must be imported before pyauto
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 def _GetTabInfo(self, windex=0, tab_index=0): 45 def _GetTabInfo(self, windex=0, tab_index=0):
46 """Helper to return info for the given tab in the given window. 46 """Helper to return info for the given tab in the given window.
47 47
48 Defaults to first tab in first window. 48 Defaults to first tab in first window.
49 """ 49 """
50 return self.GetBrowserInfo()['windows'][windex]['tabs'][tab_index] 50 return self.GetBrowserInfo()['windows'][windex]['tabs'][tab_index]
51 51
52 def testPluginCrashInfobar(self): 52 def testPluginCrashInfobar(self):
53 """Verify the "plugin crashed" infobar.""" 53 """Verify the "plugin crashed" infobar."""
54 flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf') 54 flash_url = self.GetFileURLForContentDataPath('plugin', 'flash.swf')
55 # Trigger flash plugin 55 # Trigger flash plugin
56 self.NavigateToURL(flash_url) 56 self.NavigateToURL(flash_url)
57 child_processes = self.GetBrowserInfo()['child_processes'] 57 child_processes = self.GetBrowserInfo()['child_processes']
58 flash = [x for x in child_processes if 58 flash = [x for x in child_processes if
59 x['type'] == self._flash_plugin_type and 59 x['type'] == self._flash_plugin_type and
60 x['name'] == 'Shockwave Flash'][0] 60 x['name'] == 'Shockwave Flash'][0]
61 self.assertTrue(flash) 61 self.assertTrue(flash)
62 logging.info('Killing flash plugin. pid %d' % flash['pid']) 62 logging.info('Killing flash plugin. pid %d' % flash['pid'])
63 self.Kill(flash['pid']) 63 self.Kill(flash['pid'])
64 self.assertTrue(self.WaitForInfobarCount(1)) 64 self.assertTrue(self.WaitForInfobarCount(1))
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 flash_crash_infobar_count = 0 151 flash_crash_infobar_count = 0
152 for infobar in infobars: 152 for infobar in infobars:
153 if (('text' in infobar) and 153 if (('text' in infobar) and
154 infobar['text'].startswith('Shockwave Flash has crashed')): 154 infobar['text'].startswith('Shockwave Flash has crashed')):
155 flash_crash_infobar_count += 1 155 flash_crash_infobar_count += 1
156 return flash_crash_infobar_count 156 return flash_crash_infobar_count
157 157
158 def testPluginCrashForMultiTabs(self): 158 def testPluginCrashForMultiTabs(self):
159 """Verify plugin crash infobar shows up only on the tabs using plugin.""" 159 """Verify plugin crash infobar shows up only on the tabs using plugin."""
160 non_flash_url = self.GetFileURLForDataPath('english_page.html') 160 non_flash_url = self.GetFileURLForDataPath('english_page.html')
161 flash_url = self.GetFileURLForDataPath('plugin', 'FlashSpin.swf') 161 flash_url = self.GetFileURLForContentDataPath('plugin', 'FlashSpin.swf')
162 # False = Non flash url, True = Flash url 162 # False = Non flash url, True = Flash url
163 # We have set of these values to compare a flash page and a non-flash page 163 # We have set of these values to compare a flash page and a non-flash page
164 urls_type = [False, True, False, True, False] 164 urls_type = [False, True, False, True, False]
165 for _ in range(2): 165 for _ in range(2):
166 self.AppendTab(pyauto.GURL(flash_url)) 166 self.AppendTab(pyauto.GURL(flash_url))
167 self.AppendTab(pyauto.GURL(non_flash_url)) 167 self.AppendTab(pyauto.GURL(non_flash_url))
168 # Killing flash process 168 # Killing flash process
169 child_processes = self.GetBrowserInfo()['child_processes'] 169 child_processes = self.GetBrowserInfo()['child_processes']
170 flash = [x for x in child_processes if 170 flash = [x for x in child_processes if
171 x['type'] == self._flash_plugin_type and 171 x['type'] == self._flash_plugin_type and
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 def testNoOneClickInfobarInIncognito(self): 356 def testNoOneClickInfobarInIncognito(self):
357 """Verify that one-click infobar does not show up in incognito mode.""" 357 """Verify that one-click infobar does not show up in incognito mode."""
358 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) 358 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
359 self._LogIntoGoogleAccount(windex=1) 359 self._LogIntoGoogleAccount(windex=1)
360 test_utils.AssertInfobarTypeDoesNotAppear( 360 test_utils.AssertInfobarTypeDoesNotAppear(
361 self, self.OC_INFOBAR_TYPE, windex=1) 361 self, self.OC_INFOBAR_TYPE, windex=1)
362 362
363 363
364 if __name__ == '__main__': 364 if __name__ == '__main__':
365 pyauto_functional.Main() 365 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/flash.py ('k') | chrome/test/functional/plugins.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698