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 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 self.assertTrue(self.WaitForInfobarCount(1)) | 166 self.assertTrue(self.WaitForInfobarCount(1)) |
167 self.PerformActionOnInfobar('accept', 0) | 167 self.PerformActionOnInfobar('accept', 0) |
168 self.assertTrue(self.WaitUntil( | 168 self.assertTrue(self.WaitUntil( |
169 lambda: self._GetPluginPID(plugin_name=plugin_name))) | 169 lambda: self._GetPluginPID(plugin_name=plugin_name))) |
170 self.assertTrue(self._IsEnabled(plugin_name), plugin_name) | 170 self.assertTrue(self._IsEnabled(plugin_name), plugin_name) |
171 | 171 |
172 def testBlockAllPlugins(self): | 172 def testBlockAllPlugins(self): |
173 """Verify that all the plugins can be blocked. | 173 """Verify that all the plugins can be blocked. |
174 Verifying by checking that flash plugin was blocked. | 174 Verifying by checking that flash plugin was blocked. |
175 """ | 175 """ |
176 flash_url = self.GetFileURLForPath(os.path.join( | 176 flash_url = self.GetFileURLForContentDataPath( |
177 self.DataDir(), 'plugin', 'flash-clicktoplay.html')) | 177 'plugin', 'flash-clicktoplay.html') |
178 self.NavigateToURL(flash_url) | 178 self.NavigateToURL(flash_url) |
179 flash_pid = self._GetPluginPID('Shockwave Flash') | 179 flash_pid = self._GetPluginPID('Shockwave Flash') |
180 self.assertTrue(flash_pid, msg='No plugin process for Shockwave Flash') | 180 self.assertTrue(flash_pid, msg='No plugin process for Shockwave Flash') |
181 # Killing the flash process as it takes a while before the plugin | 181 # Killing the flash process as it takes a while before the plugin |
182 # process is terminated even though there are no tabs using it. | 182 # process is terminated even though there are no tabs using it. |
183 self.Kill(flash_pid) | 183 self.Kill(flash_pid) |
184 self.assertTrue(self.WaitUntil( | 184 self.assertTrue(self.WaitUntil( |
185 lambda: self._GetPluginPID('Shockwave Flash') is None), | 185 lambda: self._GetPluginPID('Shockwave Flash') is None), |
186 msg='Expected Shockwave Flash plugin to die after killing') | 186 msg='Expected Shockwave Flash plugin to die after killing') |
187 | 187 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 # Add an exception to block plugins on localhost. | 229 # Add an exception to block plugins on localhost. |
230 self.SetPrefs(pyauto.kContentSettingsPatternPairs, | 230 self.SetPrefs(pyauto.kContentSettingsPatternPairs, |
231 {'[*.]hulu.com,*': {'plugins': 2}}) | 231 {'[*.]hulu.com,*': {'plugins': 2}}) |
232 self.GetBrowserWindow(0).GetTab(0).Reload() | 232 self.GetBrowserWindow(0).GetTab(0).Reload() |
233 self.assertFalse(self._GetPluginPID('Shockwave Flash'), | 233 self.assertFalse(self._GetPluginPID('Shockwave Flash'), |
234 msg='Shockwave Flash Plug-in not blocked.') | 234 msg='Shockwave Flash Plug-in not blocked.') |
235 | 235 |
236 | 236 |
237 if __name__ == '__main__': | 237 if __name__ == '__main__': |
238 pyauto_functional.Main() | 238 pyauto_functional.Main() |
OLD | NEW |