summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsunandt@chromium.org <sunandt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 21:24:35 +0000
committersunandt@chromium.org <sunandt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 21:24:35 +0000
commit44f724478aa3b97e69c1609598b98b2cd03d9670 (patch)
tree7224858d442f561bc105fa185fe3a67203df3da8 /chrome
parent08110ceae09a5e148e67bebd712e7ba1840ccf42 (diff)
downloadchromium_src-44f724478aa3b97e69c1609598b98b2cd03d9670.zip
chromium_src-44f724478aa3b97e69c1609598b98b2cd03d9670.tar.gz
chromium_src-44f724478aa3b97e69c1609598b98b2cd03d9670.tar.bz2
Adding tests to browser.py
1. testSharingProcess 2. testKillSharedProcess BUG=none TEST=none Review URL: http://codereview.chromium.org/5322012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/test/functional/browser.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/chrome/test/functional/browser.py b/chrome/test/functional/browser.py
index ac1785a..a7f7f18 100644
--- a/chrome/test/functional/browser.py
+++ b/chrome/test/functional/browser.py
@@ -174,6 +174,55 @@ class BrowserTest(pyauto.PyUITest):
pid2 = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid']
self.assertNotEqual(pid1, pid2)
+ def testPopupSharesProcess(self):
+ """Verify that parent tab and popup share a process."""
+ file_url = self.GetFileURLForPath(os.path.join(
+ self.DataDir(), 'popup_blocker', 'popup-blocked-to-post-blank.html'))
+ self.NavigateToURL(file_url)
+ blocked_popups = self.GetBlockedPopupsInfo()
+ self.assertEqual(1, len(blocked_popups), msg='Popup not blocked')
+ self.UnblockAndLaunchBlockedPopup(0)
+ self.assertEquals(2, self.GetBrowserWindowCount())
+ parent_pid = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid']
+ popup_pid = self.GetBrowserInfo()['windows'][1]['tabs'][0]['renderer_pid']
+ self.assertEquals(popup_pid, parent_pid,
+ msg='Parent and popup are not sharing a process.')
+
+ def testKillAndReloadSharedProcess(self):
+ """Verify that killing a shared process kills all associated renderers.
+ In this case we are killing a process shared by a parent and
+ its popup process. Reloading both should share a process again.
+ """
+ file_url = self.GetFileURLForPath(os.path.join(
+ self.DataDir(), 'popup_blocker', 'popup-blocked-to-post-blank.html'))
+ self.NavigateToURL(file_url)
+ blocked_popups = self.GetBlockedPopupsInfo()
+ self.assertEqual(1, len(blocked_popups), msg='Popup not blocked')
+ self.UnblockAndLaunchBlockedPopup(0)
+ self.assertEquals(2, self.GetBrowserWindowCount())
+ # Check that the renderers are alive.
+ self.assertEquals(1, self.FindInPage('pop-up')['match_count'])
+ self.assertEquals(1,
+ self.FindInPage('popup', tab_index=0, windex=1)['match_count'])
+ # Check if they are sharing a process id.
+ self.assertEquals(
+ self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'],
+ self.GetBrowserInfo()['windows'][1]['tabs'][0]['renderer_pid'])
+ shared_pid = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid']
+ # This method would fail if the renderers are not killed.
+ self.KillRendererProcess(shared_pid)
+
+ # Reload the parent and popup windows.
+ self.GetBrowserWindow(0).GetTab(0).Reload()
+ self.GetBrowserWindow(1).GetTab(0).Reload()
+ # Check if both are sharing a process id.
+ self.assertEquals(
+ self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'],
+ self.GetBrowserInfo()['windows'][1]['tabs'][0]['renderer_pid'])
+ # The shared process id should be different from the previous one.
+ self.assertNotEqual(shared_pid,
+ self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'])
+
if __name__ == '__main__':
pyauto_functional.Main()