1 // Copyright 2013 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.
5 #include "chrome/browser/install_verification/win/loaded_modules_snapshot.h"
12 #include "base/bind.h"
13 #include "base/callback_helpers.h"
14 #include "chrome/browser/install_verification/win/module_verification_test.h"
15 #include "testing/gtest/include/gtest/gtest.h"
17 TEST(LoadedModulesSnapshotTest
, TestCase
) {
18 std::vector
<HMODULE
> snapshot
;
20 ASSERT_TRUE(GetLoadedModulesSnapshot(&snapshot
));
21 size_t original_snapshot_size
= snapshot
.size();
22 ASSERT_GT(original_snapshot_size
, 0u);
24 HMODULE chrome_dll
= ::LoadLibrary(L
"chrome.dll");
25 ASSERT_NE(static_cast<HMODULE
>(NULL
), chrome_dll
);
26 base::ScopedClosureRunner
release_chrome_dll(
27 base::Bind(base::IgnoreResult(&::FreeLibrary
), chrome_dll
));
28 ASSERT_TRUE(GetLoadedModulesSnapshot(&snapshot
));
29 ASSERT_GT(snapshot
.size(), original_snapshot_size
);
30 ASSERT_NE(snapshot
.end(),
31 std::find(snapshot
.begin(), snapshot
.end(), chrome_dll
));