OLD | NEW |
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 os | 6 import os |
7 import re | 7 import re |
8 import types | 8 import types |
9 | 9 |
10 import pyauto_functional | 10 import pyauto_functional |
11 import pyauto | 11 import pyauto |
12 | 12 |
13 class FlashTest(pyauto.PyUITest): | 13 class FlashTest(pyauto.PyUITest): |
14 """Test Cases for Flash.""" | 14 """Test Cases for Flash.""" |
15 | 15 |
16 def setUp(self): | 16 def setUp(self): |
17 pyauto.PyUITest.setUp(self) | 17 pyauto.PyUITest.setUp(self) |
18 self._flash_plugin_type = 'Plug-in' | 18 self._flash_plugin_type = 'Plug-in' |
19 if (self.IsChromeOS() and | 19 if (self.IsChromeOS() and |
20 self.GetBrowserInfo()['properties']['branding'] == 'Google Chrome'): | 20 self.GetBrowserInfo()['properties']['branding'] == 'Google Chrome'): |
21 self._flash_plugin_type = 'Pepper Plugin' | 21 self._flash_plugin_type = 'Pepper Plugin' |
22 # Forcibly trigger all plugins to get registered. crbug.com/94123 | |
23 # Sometimes flash files loaded too quickly after firing browser | |
24 # ends up getting downloaded, which seems to indicate that the plugin | |
25 # hasn't been registered yet. | |
26 self.GetPluginsInfo() | |
27 | 22 |
28 def _AssertFlashProcessPresent(self): | 23 def _AssertFlashProcessPresent(self): |
29 child_processes = self.GetBrowserInfo()['child_processes'] | 24 child_processes = self.GetBrowserInfo()['child_processes'] |
30 self.assertTrue([x for x in child_processes | 25 self.assertTrue([x for x in child_processes |
31 if x['type'] == self._flash_plugin_type and | 26 if x['type'] == self._flash_plugin_type and |
32 x['name'] == 'Shockwave Flash']) | 27 x['name'] == 'Shockwave Flash']) |
33 | 28 |
34 def _AssertFlashProcessNotPresent(self): | 29 def _AssertFlashProcessNotPresent(self): |
35 child_processes = self.GetBrowserInfo()['child_processes'] | 30 child_processes = self.GetBrowserInfo()['child_processes'] |
36 self.assertFalse([x for x in child_processes | 31 self.assertFalse([x for x in child_processes |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 self._AssertFlashProcessNotPresent() | 117 self._AssertFlashProcessNotPresent() |
123 self.NavigateToURL(flash_url) | 118 self.NavigateToURL(flash_url) |
124 # Open 5 new tabs | 119 # Open 5 new tabs |
125 for _ in range(5): | 120 for _ in range(5): |
126 self.AppendTab(pyauto.GURL(flash_url)) | 121 self.AppendTab(pyauto.GURL(flash_url)) |
127 self._AssertFlashProcessPresent() | 122 self._AssertFlashProcessPresent() |
128 | 123 |
129 | 124 |
130 if __name__ == '__main__': | 125 if __name__ == '__main__': |
131 pyauto_functional.Main() | 126 pyauto_functional.Main() |
OLD | NEW |