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

Unified Diff: functional/browser.py

Issue 5322012: Adding tests to browser.py... (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: functional/browser.py
===================================================================
--- functional/browser.py (revision 70768)
+++ functional/browser.py (working copy)
@@ -174,6 +174,55 @@
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 they 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()
« 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