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

Unified Diff: chrome/test/ui/ui_test.cc

Issue 1377001: [GTTF] Various ui tests cleanups: (Closed)
Patch Set: Created 10 years, 9 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
« chrome/browser/images_uitest.cc ('K') | « chrome/test/ui/ui_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/ui/ui_test.cc
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index b4ae5465a236eb87034ccbaa14638542872ab717..f41c1ddaeeb0573c0fe9a8e9184cf61dee476713 100644
--- a/chrome/test/ui/ui_test.cc
+++ b/chrome/test/ui/ui_test.cc
@@ -467,6 +467,43 @@ void UITestBase::QuitBrowser() {
process_id_ = -1;
}
+void UITestBase::TerminateBrowser() {
+ // There's nothing to do here if the browser is not running.
+ if (!IsBrowserRunning())
+ return;
+
+ EXPECT_TRUE(automation()->SetFilteredInet(false));
+#if defined(OS_WIN)
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser.get());
+ ASSERT_TRUE(browser->TerminateSession());
+#endif // defined(OS_WIN)
+
+ // Now, drop the automation IPC channel so that the automation provider in
+ // the browser notices and drops its reference to the browser process.
+ automation()->Disconnect();
+
+#if defined(OS_POSIX)
+ EXPECT_EQ(kill(process_, SIGTERM), 0);
+#endif // OS_POSIX
+
+ // Wait for the browser process to quit.
+ int timeout = terminate_timeout_ms_;
+#ifdef WAIT_FOR_DEBUGGER_ON_OPEN
+ timeout = 500000;
+#endif
+ if (!base::WaitForSingleProcess(process_, timeout)) {
+ // We need to force the browser to quit because it didn't quit fast
+ // enough. Take no chance and kill every chrome processes.
+ CleanupAppProcesses();
+ }
+
+ // Don't forget to close the handle
+ base::CloseProcessHandle(process_);
+ process_ = base::kNullProcessHandle;
+ process_id_ = -1;
+}
+
void UITestBase::AssertAppNotRunning(const std::wstring& error_message) {
std::wstring final_error_message(error_message);
« chrome/browser/images_uitest.cc ('K') | « chrome/test/ui/ui_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698