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

Unified Diff: chrome/test/mini_installer/quit_chrome.py

Issue 23498025: Catch ERROR_INVALID_WINDOW_HANDLE in the quit chrome script. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address grt's comment. Created 7 years, 3 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: chrome/test/mini_installer/quit_chrome.py
diff --git a/chrome/test/mini_installer/quit_chrome.py b/chrome/test/mini_installer/quit_chrome.py
index 716ff23931fa3e467f4a7c99fde468569ca9bc40..96321b7e5bbc4530df0606fba0642f01cb44cbf7 100644
--- a/chrome/test/mini_installer/quit_chrome.py
+++ b/chrome/test/mini_installer/quit_chrome.py
@@ -9,10 +9,12 @@ the process terminates.
"""
import optparse
+import pywintypes
import sys
import time
import win32con
import win32gui
+import winerror
import chrome_helper
@@ -34,7 +36,12 @@ def CloseWindows(process_path):
return True
for hwnd in chrome_helper.GetWindowHandles(process_ids):
- win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
+ try:
+ win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
+ except pywintypes.error as error:
+ # It's normal that some window handles have become invalid.
+ if error.args[0] != winerror.ERROR_INVALID_WINDOW_HANDLE:
+ raise
time.sleep(0)
return False
« 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