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

Side by Side Diff: chrome_frame/vtable_patch_manager_unittest.cc

Issue 9111032: Change over IgnoreReturn to IgnoreResult. remove IgnoreReturn. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix it for realz Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/urlmon_url_request.cc ('k') | content/browser/browser_message_filter.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_frame/vtable_patch_manager.h" 5 #include "chrome_frame/vtable_patch_manager.h"
6 6
7 #include <unknwn.h> 7 #include <unknwn.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 EXPECT_TRUE(background.Start()); 215 EXPECT_TRUE(background.Start());
216 base::win::ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL)); 216 base::win::ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL));
217 217
218 // Grab the patch lock. 218 // Grab the patch lock.
219 vtable_patch::patch_lock_.Acquire(); 219 vtable_patch::patch_lock_.Acquire();
220 220
221 // Instruct the background thread to patch factory_. 221 // Instruct the background thread to patch factory_.
222 background.message_loop()->PostTask( 222 background.message_loop()->PostTask(
223 FROM_HERE, 223 FROM_HERE,
224 base::IgnoreReturn<HRESULT>( 224 base::Bind(base::IgnoreResult(&vtable_patch::PatchInterfaceMethods),
225 base::Bind(&vtable_patch::PatchInterfaceMethods, &factory_, 225 &factory_, &IClassFactory_PatchInfo[0]));
226 &IClassFactory_PatchInfo[0])));
227 226
228 // And subsequently to signal the event. Neither of these actions should 227 // And subsequently to signal the event. Neither of these actions should
229 // occur until we've released the patch lock. 228 // occur until we've released the patch lock.
230 background.message_loop()->PostTask( 229 background.message_loop()->PostTask(
231 FROM_HERE, base::IgnoreReturn<BOOL>(base::Bind(::SetEvent, event.Get()))); 230 FROM_HERE, base::Bind(base::IgnoreResult(::SetEvent), event.Get()));
232 231
233 // Wait for a little while, to give the background thread time to process. 232 // Wait for a little while, to give the background thread time to process.
234 // We expect this wait to time out, as the background thread should end up 233 // We expect this wait to time out, as the background thread should end up
235 // blocking on the patch lock. 234 // blocking on the patch lock.
236 EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(event.Get(), 50)); 235 EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(event.Get(), 50));
237 236
238 // Verify that patching did not take place yet. 237 // Verify that patching did not take place yet.
239 EXPECT_CALL(factory_, LockServer(TRUE)) 238 EXPECT_CALL(factory_, LockServer(TRUE))
240 .WillOnce(Return(S_FALSE)); 239 .WillOnce(Return(S_FALSE));
241 EXPECT_EQ(S_FALSE, factory_.LockServer(TRUE)); 240 EXPECT_EQ(S_FALSE, factory_.LockServer(TRUE));
(...skipping 14 matching lines...) Expand all
256 255
257 // Same deal for unpatching. 256 // Same deal for unpatching.
258 ::ResetEvent(event.Get()); 257 ::ResetEvent(event.Get());
259 258
260 // Grab the patch lock. 259 // Grab the patch lock.
261 vtable_patch::patch_lock_.Acquire(); 260 vtable_patch::patch_lock_.Acquire();
262 261
263 // Instruct the background thread to unpatch. 262 // Instruct the background thread to unpatch.
264 background.message_loop()->PostTask( 263 background.message_loop()->PostTask(
265 FROM_HERE, 264 FROM_HERE,
266 base::IgnoreReturn<HRESULT>( 265 base::Bind(base::IgnoreResult(&vtable_patch::UnpatchInterfaceMethods),
267 base::Bind(&vtable_patch::UnpatchInterfaceMethods, 266 &IClassFactory_PatchInfo[0]));
268 &IClassFactory_PatchInfo[0])));
269 267
270 // And subsequently to signal the event. Neither of these actions should 268 // And subsequently to signal the event. Neither of these actions should
271 // occur until we've released the patch lock. 269 // occur until we've released the patch lock.
272 background.message_loop()->PostTask( 270 background.message_loop()->PostTask(
273 FROM_HERE, base::IgnoreReturn<BOOL>(base::Bind(::SetEvent, event.Get()))); 271 FROM_HERE, base::Bind(base::IgnoreResult(::SetEvent), event.Get()));
274 272
275 // Wait for a little while, to give the background thread time to process. 273 // Wait for a little while, to give the background thread time to process.
276 // We expect this wait to time out, as the background thread should end up 274 // We expect this wait to time out, as the background thread should end up
277 // blocking on the patch lock. 275 // blocking on the patch lock.
278 EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(event.Get(), 50)); 276 EXPECT_EQ(WAIT_TIMEOUT, ::WaitForSingleObject(event.Get(), 50));
279 277
280 // We should still be patched. 278 // We should still be patched.
281 EXPECT_CALL(factory_, LockServer(TRUE)) 279 EXPECT_CALL(factory_, LockServer(TRUE))
282 .Times(0); 280 .Times(0);
283 EXPECT_CALL(*this, LockServerPatch(_, &factory_, TRUE)) 281 EXPECT_CALL(*this, LockServerPatch(_, &factory_, TRUE))
284 .WillOnce(Return(S_FALSE)); 282 .WillOnce(Return(S_FALSE));
285 EXPECT_EQ(S_FALSE, factory_.LockServer(TRUE)); 283 EXPECT_EQ(S_FALSE, factory_.LockServer(TRUE));
286 284
287 // Release the patch lock and wait on the event. 285 // Release the patch lock and wait on the event.
288 vtable_patch::patch_lock_.Release(); 286 vtable_patch::patch_lock_.Release();
289 EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(event.Get(), INFINITE)); 287 EXPECT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(event.Get(), INFINITE));
290 288
291 // Verify that unpatching took place. 289 // Verify that unpatching took place.
292 EXPECT_CALL(factory_, LockServer(TRUE)) 290 EXPECT_CALL(factory_, LockServer(TRUE))
293 .WillOnce(Return(S_FALSE)); 291 .WillOnce(Return(S_FALSE));
294 EXPECT_EQ(S_FALSE, factory_.LockServer(TRUE)); 292 EXPECT_EQ(S_FALSE, factory_.LockServer(TRUE));
295 } 293 }
OLDNEW
« no previous file with comments | « chrome_frame/urlmon_url_request.cc ('k') | content/browser/browser_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698