OLD | NEW |
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/crash_reporting/nt_loader.h" | 5 #include "chrome_frame/crash_reporting/nt_loader.h" |
6 | 6 |
7 #include <tlhelp32.h> | 7 #include <tlhelp32.h> |
8 #include <winnt.h> | 8 #include <winnt.h> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 EXPECT_FALSE(OwnsCriticalSection(&cs)); | 80 EXPECT_FALSE(OwnsCriticalSection(&cs)); |
81 | 81 |
82 // Make another thread grab it. | 82 // Make another thread grab it. |
83 base::Thread other("Other threads"); | 83 base::Thread other("Other threads"); |
84 ASSERT_TRUE(other.Start()); | 84 ASSERT_TRUE(other.Start()); |
85 other.message_loop()->PostTask( | 85 other.message_loop()->PostTask( |
86 FROM_HERE, base::Bind(::EnterCriticalSection, &cs)); | 86 FROM_HERE, base::Bind(::EnterCriticalSection, &cs)); |
87 | 87 |
88 base::win::ScopedHandle event(::CreateEvent(NULL, FALSE, FALSE, NULL)); | 88 base::win::ScopedHandle event(::CreateEvent(NULL, FALSE, FALSE, NULL)); |
89 other.message_loop()->PostTask( | 89 other.message_loop()->PostTask( |
90 FROM_HERE, base::IgnoreReturn<BOOL>(base::Bind(::SetEvent, event.Get()))); | 90 FROM_HERE, base::Bind(base::IgnoreResult(::SetEvent), event.Get())); |
91 | 91 |
92 ASSERT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(event.Get(), INFINITE)); | 92 ASSERT_EQ(WAIT_OBJECT_0, ::WaitForSingleObject(event.Get(), INFINITE)); |
93 | 93 |
94 // We still shouldn't own it - the other thread does. | 94 // We still shouldn't own it - the other thread does. |
95 EXPECT_FALSE(OwnsCriticalSection(&cs)); | 95 EXPECT_FALSE(OwnsCriticalSection(&cs)); |
96 // And we shouldn't be able to enter it. | 96 // And we shouldn't be able to enter it. |
97 EXPECT_EQ(0, ::TryEnterCriticalSection(&cs)); | 97 EXPECT_EQ(0, ::TryEnterCriticalSection(&cs)); |
98 | 98 |
99 // Make the other thread release it. | 99 // Make the other thread release it. |
100 other.message_loop()->PostTask( | 100 other.message_loop()->PostTask( |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 313 |
314 exceptions_handled = 0; | 314 exceptions_handled = 0; |
315 set_exception_function(OnCrashDuringUnloadLibrary); | 315 set_exception_function(OnCrashDuringUnloadLibrary); |
316 | 316 |
317 // We should crash during unload. | 317 // We should crash during unload. |
318 if (module != NULL) | 318 if (module != NULL) |
319 ::FreeLibrary(module); | 319 ::FreeLibrary(module); |
320 | 320 |
321 EXPECT_EQ(1, exceptions_handled); | 321 EXPECT_EQ(1, exceptions_handled); |
322 } | 322 } |
OLD | NEW |