Update pyauto tests to use content/test/data/plugin

chrome/test/data/plugin was moved to content/test/data/plugin
Update tests

BUG=138857
TEST=pyauto tests

R=jam@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10825006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148275 0039d316-1c4b-4281-b951-d872f2087c98
parent c254e3fc
......@@ -158,15 +158,7 @@
'-bookmarks.BookmarksTest.testAddBookmarksInMultiProfileIncognito',
'-bookmarks.BookmarksTest.testEditBookmarksInMultiProfileIncognito',
'-bookmarks.BookmarksTest.testRemoveBookmarksInMultiProfileIncognito',
'-flash.FlashTest.testFlashLoadsAfterKill',
'-infobars.InfobarTest.testPluginCrashForMultiTabs',
'-infobars.InfobarTest.testPluginCrashInfobar',
'-multiprofile.MultiprofileTest.testMakeSearchEngineDefaultInMultiprofile',
'-flash.FlashTest.testCanLoadFlash',
'-flash.FlashTest.testFlashIncognitoMode',
'-flash.FlashTest.testFlashWithMultipleTabs',
'-flash.FlashTest.testSingleFlashPluginProcess',
'-plugins.PluginsTest.testBlockAllPlugins',
],
'win': [
......
......@@ -43,13 +43,13 @@ class FlashTest(pyauto.PyUITest):
We merely check that the Flash process kicks in.
"""
flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf')
flash_url = self.GetFileURLForContentDataPath('plugin', 'flash.swf')
self.NavigateToURL(flash_url)
self._AssertFlashProcessPresent()
def testSingleFlashPluginProcess(self):
"""Verify there's only one Flash plugin process shared across all uses."""
flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf')
flash_url = self.GetFileURLForContentDataPath('plugin', 'flash.swf')
self.NavigateToURL(flash_url)
for _ in range(2):
self.AppendTab(pyauto.GURL(flash_url))
......@@ -64,7 +64,7 @@ class FlashTest(pyauto.PyUITest):
def testFlashLoadsAfterKill(self):
"""Verify that Flash process reloads after crashing (or being killed)."""
flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf')
flash_url = self.GetFileURLForContentDataPath('plugin', 'flash.swf')
self.NavigateToURL(flash_url)
flash_process_id1 = self._GetFlashProcessesInfo()[0]['pid']
self.Kill(flash_process_id1)
......@@ -96,7 +96,7 @@ class FlashTest(pyauto.PyUITest):
self.assertTrue(plugin['enabled'])
# Toggle plugin to disable flash.
self.DisablePlugin(plugin['path'])
flash_url = self.GetFileURLForDataPath('plugin', 'flash.html')
flash_url = self.GetFileURLForContentDataPath('plugin', 'flash.html')
self.NavigateToURL(flash_url)
# Verify shockwave flash process not present.
self._AssertFlashProcessNotPresent()
......@@ -105,14 +105,14 @@ class FlashTest(pyauto.PyUITest):
"""Verify we can play flash on an incognito window."""
# Verify no flash process is currently running
self._AssertFlashProcessNotPresent()
flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf')
flash_url = self.GetFileURLForContentDataPath('plugin', 'flash.swf')
self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
self.NavigateToURL(flash_url, 1, 0)
self._AssertFlashProcessPresent()
def testFlashWithMultipleTabs(self):
"""Verify we can play flash in multiple tabs."""
flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf')
flash_url = self.GetFileURLForContentDataPath('plugin', 'flash.swf')
# Verify no flash process is currently running
self._AssertFlashProcessNotPresent()
self.NavigateToURL(flash_url)
......
......@@ -51,7 +51,7 @@ class InfobarTest(pyauto.PyUITest):
def testPluginCrashInfobar(self):
"""Verify the "plugin crashed" infobar."""
flash_url = self.GetFileURLForDataPath('plugin', 'flash.swf')
flash_url = self.GetFileURLForContentDataPath('plugin', 'flash.swf')
# Trigger flash plugin
self.NavigateToURL(flash_url)
child_processes = self.GetBrowserInfo()['child_processes']
......@@ -158,7 +158,7 @@ class InfobarTest(pyauto.PyUITest):
def testPluginCrashForMultiTabs(self):
"""Verify plugin crash infobar shows up only on the tabs using plugin."""
non_flash_url = self.GetFileURLForDataPath('english_page.html')
flash_url = self.GetFileURLForDataPath('plugin', 'FlashSpin.swf')
flash_url = self.GetFileURLForContentDataPath('plugin', 'FlashSpin.swf')
# False = Non flash url, True = Flash url
# We have set of these values to compare a flash page and a non-flash page
urls_type = [False, True, False, True, False]
......
......@@ -173,8 +173,8 @@ class PluginsTest(pyauto.PyUITest):
"""Verify that all the plugins can be blocked.
Verifying by checking that flash plugin was blocked.
"""
flash_url = self.GetFileURLForPath(os.path.join(
self.DataDir(), 'plugin', 'flash-clicktoplay.html'))
flash_url = self.GetFileURLForContentDataPath(
'plugin', 'flash-clicktoplay.html')
self.NavigateToURL(flash_url)
flash_pid = self._GetPluginPID('Shockwave Flash')
self.assertTrue(flash_pid, msg='No plugin process for Shockwave Flash')
......
......@@ -607,6 +607,23 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
assert _HTTP_SERVER, 'HTTP Server not yet started'
return _HTTP_SERVER.GetURL(os.path.join('files', *relative_path)).spec()
@staticmethod
def ContentDataDir():
"""Get path to content/test/data."""
return os.path.join(PyUITest.DataDir(), os.pardir, os.pardir, os.pardir,
'content', 'test', 'data')
@staticmethod
def GetFileURLForContentDataPath(*relative_path):
"""Get file:// url for the given path relative to content test data dir.
Also quotes the url using urllib.quote().
Args:
relative_path: Variable number of strings that can be joined.
"""
return PyUITest.GetFileURLForPath(PyUITest.ContentDataDir(), *relative_path)
@staticmethod
def GetFtpURLForDataPath(ftp_server, *relative_path):
"""Get ftp:// url for the given path in the data dir.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment