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

Side by Side Diff: chrome/test/functional/browser.py

Issue 5755003: Fix pyauto flakiness by waiting for notification that the renderer process' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 10 years 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
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 os 6 import os
7 import re 7 import re
8 import types 8 import types
9 9
10 import pyauto_functional # Must be imported before pyauto 10 import pyauto_functional # Must be imported before pyauto
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 # Verify there's only 1 flash process 134 # Verify there's only 1 flash process
135 self.assertEqual(1, len(self._GetFlashProcessesInfo())) 135 self.assertEqual(1, len(self._GetFlashProcessesInfo()))
136 136
137 def testFlashLoadsAfterKill(self): 137 def testFlashLoadsAfterKill(self):
138 """Verify that Flash process reloads after crashing (or being killed).""" 138 """Verify that Flash process reloads after crashing (or being killed)."""
139 flash_url = self.GetFileURLForPath(os.path.join(self.DataDir(), 139 flash_url = self.GetFileURLForPath(os.path.join(self.DataDir(),
140 'plugin', 'flash.swf')) 140 'plugin', 'flash.swf'))
141 self.NavigateToURL(flash_url) 141 self.NavigateToURL(flash_url)
142 flash_process_id1 = self._GetFlashProcessesInfo()[0]['pid'] 142 flash_process_id1 = self._GetFlashProcessesInfo()[0]['pid']
143 self.Kill(flash_process_id1) 143 self.Kill(flash_process_id1)
144 self.GetBrowserWindow(0).GetTab(0).Reload() # Reload 144 self.ReloadActiveTab()
145 flash_processes = self._GetFlashProcessesInfo() 145 flash_processes = self._GetFlashProcessesInfo()
146 self.assertEqual(1, len(flash_processes)) 146 self.assertEqual(1, len(flash_processes))
147 self.assertNotEqual(flash_process_id1, flash_processes[0]['pid']) 147 self.assertNotEqual(flash_process_id1, flash_processes[0]['pid'])
148 148
149 def testMaxProcess(self): 149 def testMaxProcess(self):
150 """Verify that opening 100 tabs doesn't create 100 child processes""" 150 """Verify that opening 100 tabs doesn't create 100 child processes"""
151 total_tabs = 100 151 total_tabs = 100
152 test_url = self.GetFileURLForDataPath('english_page.html') 152 test_url = self.GetFileURLForDataPath('english_page.html')
153 # Opening tabs 153 # Opening tabs
154 for tab_index in range(total_tabs - 1): 154 for tab_index in range(total_tabs - 1):
155 self.AppendTab(pyauto.GURL(test_url)) 155 self.AppendTab(pyauto.GURL(test_url))
156 tabs = self.GetBrowserInfo()['windows'][0]['tabs'] 156 tabs = self.GetBrowserInfo()['windows'][0]['tabs']
157 # For the first time we have 2 tabs opened, so sending the tab_index as +2 157 # For the first time we have 2 tabs opened, so sending the tab_index as +2
158 unique_renderers = self._GetUniqProcesses(len(tabs), tabs) 158 unique_renderers = self._GetUniqProcesses(len(tabs), tabs)
159 # We verify that opening a new tab should not create a new process after 159 # We verify that opening a new tab should not create a new process after
160 # Chrome reaches to a maximum process limit. 160 # Chrome reaches to a maximum process limit.
161 if len(tabs) > unique_renderers: 161 if len(tabs) > unique_renderers:
162 return 162 return
163 # In case if we create 100 processes for 100 tabs, then we are failing. 163 # In case if we create 100 processes for 100 tabs, then we are failing.
164 self.fail(msg='Got 100 renderer processes') 164 self.fail(msg='Got 100 renderer processes')
165 165
166 def testKillAndRelodRenderer(self): 166 def testKillAndRelodRenderer(self):
AmolKher 2010/12/10 18:56:44 :s/Relod/Reload
167 """Verify that reloading of renderer is possible, 167 """Verify that reloading of renderer is possible,
168 after renderer is killed""" 168 after renderer is killed"""
169 test_url = self.GetFileURLForDataPath('english_page.html') 169 test_url = self.GetFileURLForDataPath('english_page.html')
170 self.NavigateToURL(test_url) 170 self.NavigateToURL(test_url)
171 pid1 = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'] 171 pid1 = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid']
172 self.Kill(pid1) 172 self.KillRendererProcess(pid1)
173 tab = self.GetBrowserWindow(0).GetTab(0) 173 self.ReloadActiveTab()
174 tab.Reload()
175 pid2 = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'] 174 pid2 = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid']
176 self.assertNotEqual(pid1, pid2) 175 self.assertNotEqual(pid1, pid2)
177 176
178 177
179 if __name__ == '__main__': 178 if __name__ == '__main__':
180 pyauto_functional.Main() 179 pyauto_functional.Main()
181
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698