Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 self.NavigateToURL(file_url) | 187 self.NavigateToURL(file_url) |
| 188 blocked_popups = self.GetBlockedPopupsInfo() | 188 blocked_popups = self.GetBlockedPopupsInfo() |
| 189 self.assertEqual(1, len(blocked_popups), msg='Popup not blocked') | 189 self.assertEqual(1, len(blocked_popups), msg='Popup not blocked') |
| 190 self.UnblockAndLaunchBlockedPopup(0) | 190 self.UnblockAndLaunchBlockedPopup(0) |
| 191 self.assertEquals(2, self.GetBrowserWindowCount()) | 191 self.assertEquals(2, self.GetBrowserWindowCount()) |
| 192 parent_pid = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'] | 192 parent_pid = self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'] |
| 193 popup_pid = self.GetBrowserInfo()['windows'][1]['tabs'][0]['renderer_pid'] | 193 popup_pid = self.GetBrowserInfo()['windows'][1]['tabs'][0]['renderer_pid'] |
| 194 self.assertEquals(popup_pid, parent_pid, | 194 self.assertEquals(popup_pid, parent_pid, |
| 195 msg='Parent and popup are not sharing a process.') | 195 msg='Parent and popup are not sharing a process.') |
| 196 | 196 |
| 197 def testPopupSharesSameProcessInIncognito(self): | |
| 198 """Verify parent incognito and popup share same process id""" | |
| 199 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) | |
| 200 file_url = self.GetFileURLForDataPath('popup_blocker', | |
|
Nirnimesh
2011/06/08 22:32:52
There's stray spaces at the end of thisline
| |
| 201 'popup-window-open.html') | |
| 202 self.NavigateToURL(file_url, 1, 0) | |
| 203 self.UnblockAndLaunchBlockedPopup(0, tab_index=0, windex=1) | |
| 204 self.assertEquals( | |
| 205 self.GetBrowserInfo()['windows'][1]['tabs'][0]['renderer_pid'], | |
| 206 self.GetBrowserInfo()['windows'][2]['tabs'][0]['renderer_pid'], | |
| 207 msg='Incognito window and popup are not sharing a process id.') | |
| 208 | |
| 197 def testKillAndReloadSharedProcess(self): | 209 def testKillAndReloadSharedProcess(self): |
| 198 """Verify that killing a shared process kills all associated renderers. | 210 """Verify that killing a shared process kills all associated renderers. |
| 199 In this case we are killing a process shared by a parent and | 211 In this case we are killing a process shared by a parent and |
| 200 its popup process. Reloading both should share a process again. | 212 its popup process. Reloading both should share a process again. |
| 201 """ | 213 """ |
| 202 file_url = self.GetFileURLForDataPath( | 214 file_url = self.GetFileURLForDataPath( |
| 203 'popup_blocker', 'popup-window-open.html') | 215 'popup_blocker', 'popup-window-open.html') |
| 204 self.NavigateToURL(file_url) | 216 self.NavigateToURL(file_url) |
| 205 blocked_popups = self.GetBlockedPopupsInfo() | 217 blocked_popups = self.GetBlockedPopupsInfo() |
| 206 self.assertEqual(1, len(blocked_popups), msg='Popup not blocked') | 218 self.assertEqual(1, len(blocked_popups), msg='Popup not blocked') |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 222 self.GetBrowserWindow(0).GetTab(0).Reload() | 234 self.GetBrowserWindow(0).GetTab(0).Reload() |
| 223 self.GetBrowserWindow(1).GetTab(0).Reload() | 235 self.GetBrowserWindow(1).GetTab(0).Reload() |
| 224 # Check if both are sharing a process id. | 236 # Check if both are sharing a process id. |
| 225 self.assertEquals( | 237 self.assertEquals( |
| 226 self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'], | 238 self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid'], |
| 227 self.GetBrowserInfo()['windows'][1]['tabs'][0]['renderer_pid']) | 239 self.GetBrowserInfo()['windows'][1]['tabs'][0]['renderer_pid']) |
| 228 # The shared process id should be different from the previous one. | 240 # The shared process id should be different from the previous one. |
| 229 self.assertNotEqual(shared_pid, | 241 self.assertNotEqual(shared_pid, |
| 230 self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid']) | 242 self.GetBrowserInfo()['windows'][0]['tabs'][0]['renderer_pid']) |
| 231 | 243 |
| 232 | |
| 233 if __name__ == '__main__': | 244 if __name__ == '__main__': |
| 234 pyauto_functional.Main() | 245 pyauto_functional.Main() |
| OLD | NEW |