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

Side by Side Diff: functional/plugins.py

Issue 6242007: Fixing plugins block test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/test/
Patch Set: '' Created 9 years, 11 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 | « no previous file | no next file » | 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/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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 self.SetPrefs(pyauto.kContentSettingsPatterns, 180 self.SetPrefs(pyauto.kContentSettingsPatterns,
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 # On few test machines navigation takes more than the default time so
192 # setting 1 min of wait time here.
193 test_utils.CallFunctionWithNewTimeout(self, 1 * 60 * 1000,
194 lambda:self.NavigateToURL('http://vimeo.com'))
Nirnimesh 2011/01/19 21:59:44 need a space after lambda:
191 pid = self._GetPluginPID('Shockwave Flash') 195 pid = self._GetPluginPID('Shockwave Flash')
192 self.assertTrue(pid, msg='No plugin process for Shockwave Flash') 196 self.assertTrue(pid, msg='No plugin process for Shockwave Flash')
193 self.Kill(pid) 197 self.Kill(pid)
194 self.assertTrue(self.WaitUntil( 198 self.assertTrue(self.WaitUntil(
195 lambda: self._GetPluginPID('Shockwave Flash') is None), 199 lambda: self._GetPluginPID('Shockwave Flash') is None),
196 msg='Expected Shockwave Flash plugin to die after killing') 200 msg='Expected Shockwave Flash plugin to die after killing')
197 201
198 # Add an exception to block plugins on hulu.com. 202 # Add an exception to block plugins on hulu.com.
199 self.SetPrefs(pyauto.kContentSettingsPatterns, 203 self.SetPrefs(pyauto.kContentSettingsPatterns,
200 {'[*.]hulu.com': {'plugins': 2}}) 204 {'[*.]vimeo.com': {'plugins': 2}})
201 self.GetBrowserWindow(0).GetTab(0).Reload() 205 self.GetBrowserWindow(0).GetTab(0).Reload()
202 self.assertFalse(self._GetPluginPID('Shockwave Flash'), 206 self.assertFalse(self._GetPluginPID('Shockwave Flash'),
203 msg='Plug-in not blocked.') 207 msg='Plug-in not blocked.')
204 208
205 209
206 if __name__ == '__main__': 210 if __name__ == '__main__':
207 pyauto_functional.Main() 211 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698