| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/string_util.h" | |
| 6 #include "chrome/test/unit/chrome_test_suite.h" | |
| 7 | |
| 8 #if defined(OS_WIN) | |
| 9 #define DLLEXPORT __declspec(dllexport) | |
| 10 #else | |
| 11 #define DLLEXPORT | |
| 12 #define CDECL | |
| 13 #endif | |
| 14 | |
| 15 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | |
| 16 extern "C" { | |
| 17 DLLEXPORT int CDECL RunTests(int argc, char **argv) { | |
| 18 return ChromeTestSuite(argc, argv).Run(); | |
| 19 } | |
| 20 | |
| 21 #if defined(OS_WIN) | |
| 22 DLLEXPORT int CDECL UninitializeTest() { | |
| 23 // The CRichEditCtrl (used by the omnibox) calls OleInitialize, but somehow | |
| 24 // does not always calls OleUninitialize, causing an unbalanced Ole | |
| 25 // initialization that triggers a DCHECK in ScopedOleInitializer the next | |
| 26 // time we run a test. | |
| 27 // This behavior has been seen on some Vista boxes, but not all of them. | |
| 28 // There is a flag to prevent Ole initialization in CRichEditCtrl (see | |
| 29 // http://support.microsoft.com/kb/238989), but it is set to 0 in recent | |
| 30 // Windows versions. | |
| 31 // This is a dirty hack to make sure the OleCount is back to 0 in all cases, | |
| 32 // so the next test will have Ole unitialized, as expected. | |
| 33 | |
| 34 if (OleInitialize(NULL) == S_FALSE) { | |
| 35 // We were already initialized, balance that extra-initialization. | |
| 36 OleUninitialize(); | |
| 37 } | |
| 38 // Balance the OleInitialize from the above test. | |
| 39 OleUninitialize(); | |
| 40 | |
| 41 return 0; // 0 means uninitialization OK. | |
| 42 } | |
| 43 #endif | |
| 44 | |
| 45 } | |
| OLD | NEW |