OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 |
11 import pyauto | 11 import pyauto |
12 import test_utils | |
12 | 13 |
13 | 14 |
14 class PluginsTest(pyauto.PyUITest): | 15 class PluginsTest(pyauto.PyUITest): |
15 """TestCase for Plugins.""" | 16 """TestCase for Plugins.""" |
16 | 17 |
17 def Debug(self): | 18 def Debug(self): |
18 """Test method for experimentation. | 19 """Test method for experimentation. |
19 | 20 |
20 This method will not run automatically. | 21 This method will not run automatically. |
21 """ | 22 """ |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 {'[*.]hulu.com': {'plugins': 1}}) | 181 {'[*.]hulu.com': {'plugins': 1}}) |
181 self.AppendTab(pyauto.GURL('http://www.hulu.com')) | 182 self.AppendTab(pyauto.GURL('http://www.hulu.com')) |
182 self.assertTrue(self._GetPluginPID('Shockwave Flash'), | 183 self.assertTrue(self._GetPluginPID('Shockwave Flash'), |
183 msg='No plugin process for Shockwave Flash') | 184 msg='No plugin process for Shockwave Flash') |
184 | 185 |
185 def testBlockPluginException(self): | 186 def testBlockPluginException(self): |
186 """Verify that plugins can be blocked on a domain by adding | 187 """Verify that plugins can be blocked on a domain by adding |
187 an exception(s).""" | 188 an exception(s).""" |
188 # We are using the same live site in order to detect if the web page | 189 # We are using the same live site in order to detect if the web page |
189 # is using shockwave flash process | 190 # is using shockwave flash process |
190 self.NavigateToURL('http://www.hulu.com') | 191 self.SetOmniboxText('http://vimeo.com') |
Nirnimesh
2011/01/19 21:13:38
why not use navigateToURL?
| |
192 # On few test machines navigation takes more than the default time so | |
193 # setting 1 min of wait time here. | |
194 test_utils.CallFunctionWithNewTimeout(self, 1 * 60 * 1000, | |
195 self.OmniboxAcceptInput) | |
191 pid = self._GetPluginPID('Shockwave Flash') | 196 pid = self._GetPluginPID('Shockwave Flash') |
192 self.assertTrue(pid, msg='No plugin process for Shockwave Flash') | 197 self.assertTrue(pid, msg='No plugin process for Shockwave Flash') |
193 self.Kill(pid) | 198 self.Kill(pid) |
194 self.assertTrue(self.WaitUntil( | 199 self.assertTrue(self.WaitUntil( |
195 lambda: self._GetPluginPID('Shockwave Flash') is None), | 200 lambda: self._GetPluginPID('Shockwave Flash') is None), |
196 msg='Expected Shockwave Flash plugin to die after killing') | 201 msg='Expected Shockwave Flash plugin to die after killing') |
197 | 202 |
198 # Add an exception to block plugins on hulu.com. | 203 # Add an exception to block plugins on hulu.com. |
199 self.SetPrefs(pyauto.kContentSettingsPatterns, | 204 self.SetPrefs(pyauto.kContentSettingsPatterns, |
200 {'[*.]hulu.com': {'plugins': 2}}) | 205 {'[*.]vimeo.com': {'plugins': 2}}) |
201 self.GetBrowserWindow(0).GetTab(0).Reload() | 206 self.GetBrowserWindow(0).GetTab(0).Reload() |
202 self.assertFalse(self._GetPluginPID('Shockwave Flash'), | 207 self.assertFalse(self._GetPluginPID('Shockwave Flash'), |
203 msg='Plug-in not blocked.') | 208 msg='Plug-in not blocked.') |
204 | 209 |
205 | 210 |
206 if __name__ == '__main__': | 211 if __name__ == '__main__': |
207 pyauto_functional.Main() | 212 pyauto_functional.Main() |
OLD | NEW |