diff options
author | siggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-26 19:21:18 +0000 |
---|---|---|
committer | siggi@chromium.org <siggi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-26 19:21:18 +0000 |
commit | 6e5110dff1b382e0e330c0e733e85d0b0ec45a31 (patch) | |
tree | 75c6785c6a5d53f2c536e82f08adcf9b7c165f05 | |
parent | ecc0738c8ec3fe083ea639740e4a3ebbc695114d (diff) | |
download | chromium_src-6e5110dff1b382e0e330c0e733e85d0b0ec45a31.zip chromium_src-6e5110dff1b382e0e330c0e733e85d0b0ec45a31.tar.gz chromium_src-6e5110dff1b382e0e330c0e733e85d0b0ec45a31.tar.bz2 |
Make minidump test deterministic by explicitly loading and unloading a specific DLL,
instead of relying on CoInitialize/CoUninitialize to load and unload at least one DLL.
Add minidump_test as a dependency to make sure it's always built.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/661081
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40142 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome_frame/chrome_frame.gyp | 1 | ||||
-rw-r--r-- | chrome_frame/crash_reporting/minidump_test.cc | 18 |
2 files changed, 14 insertions, 5 deletions
diff --git a/chrome_frame/chrome_frame.gyp b/chrome_frame/chrome_frame.gyp index a60e9c0..6516581 100644 --- a/chrome_frame/chrome_frame.gyp +++ b/chrome_frame/chrome_frame.gyp @@ -633,6 +633,7 @@ '../google_update/google_update.gyp:google_update', # Crash Reporting 'crash_reporting/crash_reporting.gyp:crash_report', + 'crash_reporting/crash_reporting.gyp:minidump_test', 'crash_reporting/crash_reporting.gyp:vectored_handler_tests', ], },], diff --git a/chrome_frame/crash_reporting/minidump_test.cc b/chrome_frame/crash_reporting/minidump_test.cc index 442cbeb..3b4f0e6 100644 --- a/chrome_frame/crash_reporting/minidump_test.cc +++ b/chrome_frame/crash_reporting/minidump_test.cc @@ -47,6 +47,15 @@ class MinidumpTest: public testing::Test { } virtual void SetUp() { + // Make sure URLMon isn't loaded into our process. + ASSERT_EQ(NULL, ::GetModuleHandle(L"urlmon.dll")); + + // Then load and unload it to ensure we have something to + // stock the unloaded module list with. + HMODULE urlmon = ::LoadLibrary(L"urlmon.dll"); + ASSERT_TRUE(urlmon != NULL); + ASSERT_TRUE(::FreeLibrary(urlmon)); + ASSERT_TRUE(file_util::CreateTemporaryFile(&dump_file_)); dump_file_handle_.Set(::CreateFile(dump_file_.value().c_str(), GENERIC_WRITE | GENERIC_READ, @@ -122,6 +131,9 @@ class MinidumpTest: public testing::Test { &ex_info, NULL, NULL); + LOG(INFO) << "Flags: " << flags << " mindump size: " << + ::GetFileSize(dump_file_handle_.Get(), NULL); + return result == TRUE; } @@ -384,7 +396,7 @@ TEST_F(MinidumpTest, LargerDump) { EXPECT_FALSE(DumpHasStream(TokenStream)); } -TEST_F(MinidumpTest, LargeDump) { +TEST_F(MinidumpTest, FullDump) { ASSERT_TRUE(WriteDump(kFullDumpType)); // The dump should have all of these streams. @@ -421,10 +433,6 @@ int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); CommandLine::Init(argc, argv); - // CoInitialize and uninitialize to load and unload some modules. - ::CoInitialize(NULL); - ::CoUninitialize(); - logging::InitLogging(L"CON", logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, logging::DONT_LOCK_LOG_FILE, |