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 <atlbase.h> | 5 #include <atlbase.h> |
6 | 6 |
7 #include "base/environment.h" | 7 #include "base/environment.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome_frame/crash_reporting/crash_dll.h" | 10 #include "chrome_frame/crash_reporting/crash_dll.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // Exception in a loading module, we are on the stack. | 134 // Exception in a loading module, we are on the stack. |
135 // Make sure we don't report it. | 135 // Make sure we don't report it. |
136 api.SetSEH(no_seh); | 136 api.SetSEH(no_seh); |
137 api.SetStack(on_stack); | 137 api.SetStack(on_stack); |
138 EXPECT_CALL(api, WriteDump(_)).Times(0); | 138 EXPECT_CALL(api, WriteDump(_)).Times(0); |
139 | 139 |
140 g_mock_veh = &veh; | 140 g_mock_veh = &veh; |
141 void* id = ::AddVectoredExceptionHandler(FALSE, VEH); | 141 void* id = ::AddVectoredExceptionHandler(FALSE, VEH); |
142 | 142 |
143 scoped_ptr<base::Environment> env(base::Environment::Create()); | 143 scoped_ptr<base::Environment> env(base::Environment::Create()); |
144 EXPECT_TRUE(env->SetVar(WideToUTF8(kCrashOnLoadMode).c_str(), "1")); | 144 EXPECT_TRUE(env->SetVar(base::WideToUTF8(kCrashOnLoadMode).c_str(), "1")); |
145 long exceptions_seen = veh.get_exceptions_seen(); | 145 long exceptions_seen = veh.get_exceptions_seen(); |
146 HMODULE module = ::LoadLibrary(kCrashDllName); | 146 HMODULE module = ::LoadLibrary(kCrashDllName); |
147 EXPECT_EQ(NULL, module); | 147 EXPECT_EQ(NULL, module); |
148 | 148 |
149 testing::Mock::VerifyAndClearExpectations(&api); | 149 testing::Mock::VerifyAndClearExpectations(&api); |
150 EXPECT_EQ(exceptions_seen + 1, veh.get_exceptions_seen()); | 150 EXPECT_EQ(exceptions_seen + 1, veh.get_exceptions_seen()); |
151 EXPECT_TRUE(env->UnSetVar(WideToUTF8(kCrashOnLoadMode).c_str())); | 151 EXPECT_TRUE(env->UnSetVar(base::WideToUTF8(kCrashOnLoadMode).c_str())); |
152 | 152 |
153 // Exception in an unloading module, we are on the stack/ | 153 // Exception in an unloading module, we are on the stack/ |
154 // Make sure we report it. | 154 // Make sure we report it. |
155 EXPECT_TRUE(env->SetVar(WideToUTF8(kCrashOnUnloadMode).c_str(), "1")); | 155 EXPECT_TRUE(env->SetVar(base::WideToUTF8(kCrashOnUnloadMode).c_str(), "1")); |
156 | 156 |
157 module = ::LoadLibrary(kCrashDllName); | 157 module = ::LoadLibrary(kCrashDllName); |
158 | 158 |
159 api.SetSEH(no_seh); | 159 api.SetSEH(no_seh); |
160 api.SetStack(on_stack); | 160 api.SetStack(on_stack); |
161 EXPECT_CALL(api, WriteDump(_)).Times(1); | 161 EXPECT_CALL(api, WriteDump(_)).Times(1); |
162 EXPECT_TRUE(module != NULL); | 162 EXPECT_TRUE(module != NULL); |
163 exceptions_seen = veh.get_exceptions_seen(); | 163 exceptions_seen = veh.get_exceptions_seen(); |
164 | 164 |
165 // Crash on unloading. | 165 // Crash on unloading. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 DWORD tid; | 220 DWORD tid; |
221 HANDLE h = ::CreateThread(0, 0, CrashingThread, 0, 0, &tid); | 221 HANDLE h = ::CreateThread(0, 0, CrashingThread, 0, 0, &tid); |
222 ::WaitForSingleObject(h, INFINITE); | 222 ::WaitForSingleObject(h, INFINITE); |
223 ::CloseHandle(h); | 223 ::CloseHandle(h); |
224 | 224 |
225 EXPECT_EQ(2, veh.get_exceptions_seen()); | 225 EXPECT_EQ(2, veh.get_exceptions_seen()); |
226 ::RemoveVectoredExceptionHandler(id); | 226 ::RemoveVectoredExceptionHandler(id); |
227 g_mock_veh = NULL; | 227 g_mock_veh = NULL; |
228 } | 228 } |
OLD | NEW |