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

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

Issue 1210013007: clang/win: Fix warnings to prepare for building without -Wno-reorder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clang-unsequenced
Patch Set: Created 5 years, 5 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
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 } 118 }
119 } 119 }
120 120
121 // Implements a thread to launch the ChromeWatcherClient and block on 121 // Implements a thread to launch the ChromeWatcherClient and block on
122 // EnsureInitialized. Provides various helpers to interact with the 122 // EnsureInitialized. Provides various helpers to interact with the
123 // ChromeWatcherClient. 123 // ChromeWatcherClient.
124 class ChromeWatcherClientThread : public base::SimpleThread { 124 class ChromeWatcherClientThread : public base::SimpleThread {
125 public: 125 public:
126 ChromeWatcherClientThread() 126 ChromeWatcherClientThread()
127 : client_(base::Bind(&ChromeWatcherClientThread::GenerateCommandLine, 127 : SimpleThread("ChromeWatcherClientTest thread"),
128 client_(base::Bind(&ChromeWatcherClientThread::GenerateCommandLine,
128 base::Unretained(this))), 129 base::Unretained(this))),
129 complete_(false, false), 130 complete_(false, false),
130 result_(false), 131 result_(false) {}
131 SimpleThread("ChromeWatcherClientTest thread") {}
132 132
133 // Waits up to |timeout| for the call to EnsureInitialized to complete. If it 133 // Waits up to |timeout| for the call to EnsureInitialized to complete. If it
134 // does, sets |result| to the return value of EnsureInitialized and returns 134 // does, sets |result| to the return value of EnsureInitialized and returns
135 // true. Otherwise returns false. 135 // true. Otherwise returns false.
136 bool WaitForResultWithTimeout(base::TimeDelta timeout, bool* result) { 136 bool WaitForResultWithTimeout(base::TimeDelta timeout, bool* result) {
137 if (!complete_.TimedWait(timeout)) 137 if (!complete_.TimedWait(timeout))
138 return false; 138 return false;
139 *result = result_; 139 *result = result_;
140 return true; 140 return true;
141 } 141 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // Give a broken implementation a chance to exit unexpectedly. 260 // Give a broken implementation a chance to exit unexpectedly.
261 ASSERT_FALSE(thread().WaitForResultWithTimeout( 261 ASSERT_FALSE(thread().WaitForResultWithTimeout(
262 base::TimeDelta::FromMilliseconds(100), &result)); 262 base::TimeDelta::FromMilliseconds(100), &result));
263 ASSERT_TRUE(SignalExit()); 263 ASSERT_TRUE(SignalExit());
264 ASSERT_FALSE(thread().WaitForResult()); 264 ASSERT_FALSE(thread().WaitForResult());
265 int exit_code = 0; 265 int exit_code = 0;
266 ASSERT_TRUE( 266 ASSERT_TRUE(
267 thread().client().WaitForExitWithTimeout(base::TimeDelta(), &exit_code)); 267 thread().client().WaitForExitWithTimeout(base::TimeDelta(), &exit_code));
268 ASSERT_EQ(0, exit_code); 268 ASSERT_EQ(0, exit_code);
269 } 269 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698