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

Side by Side Diff: chrome/app/chrome_watcher_client_unittest_win.cc

Issue 1086363003: Handled nullptr argument in WaitForExit() and WaitForExitWithTimeout() methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments incorporated. Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « base/process/process_win.cc ('k') | chrome/browser/process_singleton_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/app/chrome_watcher_client_win.h" 5 #include "chrome/app/chrome_watcher_client_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <string> 8 #include <string>
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 ASSERT_TRUE(exit_event_.IsValid()); 214 ASSERT_TRUE(exit_event_.IsValid());
215 initialize_event_.Set(::CreateEvent( 215 initialize_event_.Set(::CreateEvent(
216 NULL, FALSE, FALSE, 216 NULL, FALSE, FALSE,
217 (kInitializeEventBaseName + thread_.NamedEventSuffix()).c_str())); 217 (kInitializeEventBaseName + thread_.NamedEventSuffix()).c_str()));
218 ASSERT_TRUE(initialize_event_.IsValid()); 218 ASSERT_TRUE(initialize_event_.IsValid());
219 } 219 }
220 220
221 void TearDown() override { 221 void TearDown() override {
222 // Even if we never launched, the following is harmless. 222 // Even if we never launched, the following is harmless.
223 SignalExit(); 223 SignalExit();
224 int exit_code = 0; 224 thread_.client().WaitForExit(nullptr);
225 thread_.client().WaitForExit(&exit_code);
226 thread_.Join(); 225 thread_.Join();
227 } 226 }
228 227
229 private: 228 private:
230 // Used to launch and block on the Chrome watcher process in a background 229 // Used to launch and block on the Chrome watcher process in a background
231 // thread. 230 // thread.
232 ChromeWatcherClientThread thread_; 231 ChromeWatcherClientThread thread_;
233 // Used to signal the Chrome watcher process to exit. 232 // Used to signal the Chrome watcher process to exit.
234 base::win::ScopedHandle exit_event_; 233 base::win::ScopedHandle exit_event_;
235 // Used to signal the Chrome watcher process to signal its own 234 // Used to signal the Chrome watcher process to signal its own
(...skipping 25 matching lines...) Expand all
261 // Give a broken implementation a chance to exit unexpectedly. 260 // Give a broken implementation a chance to exit unexpectedly.
262 ASSERT_FALSE(thread().WaitForResultWithTimeout( 261 ASSERT_FALSE(thread().WaitForResultWithTimeout(
263 base::TimeDelta::FromMilliseconds(100), &result)); 262 base::TimeDelta::FromMilliseconds(100), &result));
264 ASSERT_TRUE(SignalExit()); 263 ASSERT_TRUE(SignalExit());
265 ASSERT_FALSE(thread().WaitForResult()); 264 ASSERT_FALSE(thread().WaitForResult());
266 int exit_code = 0; 265 int exit_code = 0;
267 ASSERT_TRUE( 266 ASSERT_TRUE(
268 thread().client().WaitForExitWithTimeout(base::TimeDelta(), &exit_code)); 267 thread().client().WaitForExitWithTimeout(base::TimeDelta(), &exit_code));
269 ASSERT_EQ(0, exit_code); 268 ASSERT_EQ(0, exit_code);
270 } 269 }
OLDNEW
« no previous file with comments | « base/process/process_win.cc ('k') | chrome/browser/process_singleton_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698