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

Unified Diff: chrome_watchdog_test.cc

Issue 6012007: wm: Fix FD leak in watchdog when Chrome is hanging. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/window_manager.git@master
Patch Set: fix typo in comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_watchdog.cc ('k') | event_loop.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_watchdog_test.cc
diff --git a/chrome_watchdog_test.cc b/chrome_watchdog_test.cc
index fa072c2045f5adb25f32b624907809fb4a4249bc..4f968364a8a9d3591626ec530ec14025a7578863 100644
--- a/chrome_watchdog_test.cc
+++ b/chrome_watchdog_test.cc
@@ -35,9 +35,13 @@ TEST_F(ChromeWatchdogTest, Basic) {
const XAtom kClientMachineAtom = xconn_->GetAtomOrDie("WM_CLIENT_MACHINE");
const XAtom kCardinalAtom = xconn_->GetAtomOrDie("CARDINAL");
- int kPid = 456;
- int kTimestamp = 123;
- int kTimeoutMs = 5000;
+ const int kPid = 456;
+ const int kTimestamp = 123;
+ const int kTimeoutMs = 5000;
+
+ // Make sure that we don't leak any timeouts, either when we get a response
+ // from Chrome or when a timeout fires (http://crosbug.com/10583).
+ const int kInitialNumTimeouts = event_loop_->num_timeouts();
// We should fail if no windows have been mapped.
EXPECT_FALSE(watchdog->SendPingToChrome(kTimestamp, kTimeoutMs));
@@ -120,6 +124,7 @@ TEST_F(ChromeWatchdogTest, Basic) {
EXPECT_FALSE(watchdog->has_outstanding_ping());
EXPECT_EQ(-1, watchdog->timeout_id_);
EXPECT_EQ(-1, watchdog->last_killed_pid_);
+ EXPECT_EQ(kInitialNumTimeouts, event_loop_->num_timeouts());
// If the timeout is invoked after we send the ping, we should kill
// Chrome (well, not really, since this is a test, but 'last_killed_pid_'
@@ -129,6 +134,7 @@ TEST_F(ChromeWatchdogTest, Basic) {
EXPECT_FALSE(watchdog->has_outstanding_ping());
EXPECT_EQ(-1, watchdog->timeout_id_);
EXPECT_EQ(kPid, watchdog->last_killed_pid_);
+ EXPECT_EQ(kInitialNumTimeouts, event_loop_->num_timeouts());
}
} // namespace window_manager
« no previous file with comments | « chrome_watchdog.cc ('k') | event_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698