diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-16 10:03:01 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-16 10:03:01 +0000 |
commit | 09fe8bebeb1c9a11719072d67d71cc305baab891 (patch) | |
tree | 6491bde9348f88bdf24c40bbeca481ca6d2458b9 /chrome/browser/enumerate_modules_model_unittest_win.cc | |
parent | d1c2e5fbfe9d64206c26bfaaa0dcaf9887751c4a (diff) | |
download | chromium_src-09fe8bebeb1c9a11719072d67d71cc305baab891.zip chromium_src-09fe8bebeb1c9a11719072d67d71cc305baab891.tar.gz chromium_src-09fe8bebeb1c9a11719072d67d71cc305baab891.tar.bz2 |
Fix problem with %temp% paths not collapsing correctly.
Also update the blacklist so that modules that are not suspected
malware don't get linked to the Help Center (the Help Center will
only have a malware article to being with).
BUG=66885
TEST=Covered by unit test.
Review URL: http://codereview.chromium.org/5894001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69385 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/enumerate_modules_model_unittest_win.cc')
-rw-r--r-- | chrome/browser/enumerate_modules_model_unittest_win.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/chrome/browser/enumerate_modules_model_unittest_win.cc b/chrome/browser/enumerate_modules_model_unittest_win.cc index 841c420..7aa6b63 100644 --- a/chrome/browser/enumerate_modules_model_unittest_win.cc +++ b/chrome/browser/enumerate_modules_model_unittest_win.cc @@ -190,3 +190,34 @@ TEST_F(EnumerateModulesTest, MatchFunction) { ModuleEnumerator::Match(test, blacklist)); } } + +const struct CollapsePathList { + string16 expected_result; + string16 test_case; +} kCollapsePathList[] = { + // Negative testing (should not collapse this path). + { ASCIIToUTF16("c:\\a\\a.dll"), ASCIIToUTF16("c:\\a\\a.dll") }, + // These two are to test that we select the maximum collapsed path. + { ASCIIToUTF16("%foo%\\a.dll"), ASCIIToUTF16("c:\\foo\\a.dll") }, + { ASCIIToUTF16("%x%\\a.dll"), ASCIIToUTF16("c:\\foo\\bar\\a.dll") }, +}; + +TEST_F(EnumerateModulesTest, CollapsePath) { + scoped_refptr<ModuleEnumerator> module_enumerator(new ModuleEnumerator(NULL)); + module_enumerator->path_mapping_.clear(); + module_enumerator->path_mapping_.push_back( + std::make_pair(L"c:\\foo\\", L"%foo%")); + module_enumerator->path_mapping_.push_back( + std::make_pair(L"c:\\foo\\bar\\", L"%x%")); + + for (size_t i = 0; i < arraysize(kCollapsePathList); ++i) { + ModuleEnumerator::Module module; + module.location = kCollapsePathList[i].test_case; + module_enumerator->CollapsePath(&module); + + SCOPED_TRACE("Test case no " + base::IntToString(i) + + ": '" + UTF16ToASCII(kCollapsePathList[i].expected_result) + + "'"); + EXPECT_EQ(kCollapsePathList[i].expected_result, module.location); + } +} |