OLD | NEW |
---|---|
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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.Kill(pid1) |
173 tab = self.GetBrowserWindow(0).GetTab(0) | 173 tab = self.GetBrowserWindow(0).GetTab(0) |
174 tab.Reload() | 174 tab.Reload() |
175 pid2 = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'] | 175 pid2 = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'] |
176 self.assertNotEqual(pid1, pid2) | 176 self.assertNotEqual(pid1, pid2) |
177 | 177 |
178 def testSharingProcess(self): | |
Nirnimesh
2010/11/30 21:31:12
rename: testPopupSharesProcess
sunandt
2010/12/07 02:29:36
Done.
| |
179 """Verify that parent tab and popup share a process.""" | |
180 file_url = self.GetFileURLForPath(os.path.join( | |
181 self.DataDir(), 'popup_blocker', 'popup-blocked-to-post-blank.html')) | |
182 self.NavigateToURL(file_url) | |
183 blocked_popups = self.GetBlockedPopupsInfo() | |
184 self.assertEqual(1, len(blocked_popups), msg='Popup not blocked') | |
185 self.UnblockAndLaunchBlockedPopup(0) | |
186 self.assertEquals(2, self.GetBrowserWindowCount()) | |
187 parent_id = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'] | |
Nirnimesh
2010/11/30 21:31:12
s/parent_id/parent_pid/
sunandt
2010/12/07 02:29:36
Done.
| |
188 popup_id = self.GetBrowserInfo()['windows'][1]['tabs'][0]['renderer_pid'] | |
Nirnimesh
2010/11/30 21:31:12
s/popup_id/popup_pid/
sunandt
2010/12/07 02:29:36
Done.
| |
189 self.assertEquals(popup_id, parent_id, | |
190 msg='Parent and popup are not sharing a process.') | |
191 | |
192 def testKillSharedProcess(self): | |
Nirnimesh
2010/11/30 21:31:12
rename: testKillPopupProcess
sunandt
2010/12/07 02:29:36
We are killing a process which is shared by both t
| |
193 """Verify that killing a shared process kills all renderers.""" | |
Nirnimesh
2010/11/30 21:31:12
Please elaborate
sunandt
2010/12/07 02:29:36
Done.
| |
194 file_url = self.GetFileURLForPath(os.path.join( | |
195 self.DataDir(), 'popup_blocker', 'popup-blocked-to-post-blank.html')) | |
196 self.NavigateToURL(file_url) | |
197 blocked_popups = self.GetBlockedPopupsInfo() | |
198 self.assertEqual(1, len(blocked_popups), msg='Popup not blocked') | |
199 self.UnblockAndLaunchBlockedPopup(0) | |
200 self.assertEquals(2, self.GetBrowserWindowCount()) | |
201 # Check that the renderers are alive. | |
202 self.assertEquals(1, self.FindInPage('pop-up')['match_count']) | |
203 self.assertEquals(1, | |
204 self.FindInPage('popup', tab_index=0, windex=1)['match_count']) | |
205 renderer_id = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'] | |
206 self.Kill(renderer_id) | |
207 | |
208 # Check that the renderers are killed and their pid equals to browser pid. | |
209 browser_pid = self.GetBrowserInfo()['browser_pid'] | |
210 self.assertEquals(browser_pid, | |
211 self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid']) | |
212 self.assertEquals(browser_pid, | |
213 self.GetBrowserInfo()['windows'][1]['tabs'][0]['renderer_pid']) | |
214 | |
178 | 215 |
179 if __name__ == '__main__': | 216 if __name__ == '__main__': |
180 pyauto_functional.Main() | 217 pyauto_functional.Main() |
181 | 218 |
OLD | NEW |