| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 for plugin in self.GetPluginsInfo().Plugins(): | 86 for plugin in self.GetPluginsInfo().Plugins(): |
| 87 if re.search('Shockwave Flash', plugin['name']): | 87 if re.search('Shockwave Flash', plugin['name']): |
| 88 self.assertTrue(plugin['enabled']) | 88 self.assertTrue(plugin['enabled']) |
| 89 # Toggle plugin to disable flash. | 89 # Toggle plugin to disable flash. |
| 90 self.DisablePlugin(plugin['path']) | 90 self.DisablePlugin(plugin['path']) |
| 91 flash_url = self.GetFileURLForDataPath('plugin', 'flash.html') | 91 flash_url = self.GetFileURLForDataPath('plugin', 'flash.html') |
| 92 self.NavigateToURL(flash_url) | 92 self.NavigateToURL(flash_url) |
| 93 # Verify shockwave flash process not present. | 93 # Verify shockwave flash process not present. |
| 94 self._AssertFlashProcessNotPresent() | 94 self._AssertFlashProcessNotPresent() |
| 95 | 95 |
| 96 def testYouTubeVideo(self): | |
| 97 """Verify able to watch youtube.com.""" | |
| 98 youtube_url = 'http://www.youtube.com/watch?v=0QRO3gKj3qw' | |
| 99 # Verify no flash process is present. | |
| 100 self._AssertFlashProcessNotPresent() | |
| 101 # Play YouTube video. | |
| 102 self.NavigateToURL(youtube_url) | |
| 103 self._AssertFlashProcessPresent() | |
| 104 | |
| 105 def testFlashIncognitoMode(self): | 96 def testFlashIncognitoMode(self): |
| 106 """Verify we can play flash on an incognito window.""" | 97 """Verify we can play flash on an incognito window.""" |
| 107 if self.IsMac(): | 98 if self.IsMac(): |
| 108 # On Mac 10.5, flash files loaded too quickly after firing browser ends | 99 # On Mac 10.5, flash files loaded too quickly after firing browser ends |
| 109 # up getting downloaded, which seems to indicate that the plugin hasn't | 100 # up getting downloaded, which seems to indicate that the plugin hasn't |
| 110 # been registered yet. | 101 # been registered yet. |
| 111 # Hack to register Flash plugin on Mac 10.5. crbug.com/94123 | 102 # Hack to register Flash plugin on Mac 10.5. crbug.com/94123 |
| 112 self.GetPluginsInfo() | 103 self.GetPluginsInfo() |
| 113 # Verify no flash process is currently running | 104 # Verify no flash process is currently running |
| 114 self._AssertFlashProcessNotPresent() | 105 self._AssertFlashProcessNotPresent() |
| 115 flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf') | 106 flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf') |
| 116 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) | 107 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
| 117 self.NavigateToURL(flash_url, 1, 0) | 108 self.NavigateToURL(flash_url, 1, 0) |
| 118 self._AssertFlashProcessPresent() | 109 self._AssertFlashProcessPresent() |
| 119 | 110 |
| 120 def testFlashWithMultipleTabs(self): | 111 def testFlashWithMultipleTabs(self): |
| 121 """Verify we can play flash in multiple tabs.""" | 112 """Verify we can play flash in multiple tabs.""" |
| 122 flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf') | 113 flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf') |
| 123 # Verify no flash process is currently running | 114 # Verify no flash process is currently running |
| 124 self._AssertFlashProcessNotPresent() | 115 self._AssertFlashProcessNotPresent() |
| 125 self.NavigateToURL(flash_url) | 116 self.NavigateToURL(flash_url) |
| 126 # Open 5 new tabs | 117 # Open 5 new tabs |
| 127 for _ in range(5): | 118 for _ in range(5): |
| 128 self.AppendTab(pyauto.GURL(flash_url)) | 119 self.AppendTab(pyauto.GURL(flash_url)) |
| 129 self._AssertFlashProcessPresent() | 120 self._AssertFlashProcessPresent() |
| 130 | 121 |
| 131 | 122 |
| 132 if __name__ == '__main__': | 123 if __name__ == '__main__': |
| 133 pyauto_functional.Main() | 124 pyauto_functional.Main() |
| OLD | NEW |