diff options
author | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-15 06:12:03 +0000 |
---|---|---|
committer | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-15 06:12:03 +0000 |
commit | 17654a99e28ee744f10cb5c794bbaa78819f200b (patch) | |
tree | 7f1231527e0a9a7dc35106bcb72bcb96af4e6ab4 /chrome/tools/convert_dict | |
parent | fa77815fbc4785e6a4ea095329ecc1f41b75c2bd (diff) | |
download | chromium_src-17654a99e28ee744f10cb5c794bbaa78819f200b.zip chromium_src-17654a99e28ee744f10cb5c794bbaa78819f200b.tar.gz chromium_src-17654a99e28ee744f10cb5c794bbaa78819f200b.tar.bz2 |
Add sanity checks of the BDIC files to Chrome.
This change updates ConvertDictTest that trims the end of BDICTs and verify hunspell::BDict::Verify() treats the trimmed BDICTs as corrupted. (This is a Chromium-side change of r65351 <http://crrev.com/65351>.)
BUG=61206
TEST=unit_tests.exe --gtest_filter=ConvertDictTest.*
Review URL: http://codereview.chromium.org/4477002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66098 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools/convert_dict')
-rw-r--r-- | chrome/tools/convert_dict/convert_dict_unittest.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/chrome/tools/convert_dict/convert_dict_unittest.cc b/chrome/tools/convert_dict/convert_dict_unittest.cc index 25568a1..5f56c69 100644 --- a/chrome/tools/convert_dict/convert_dict_unittest.cc +++ b/chrome/tools/convert_dict/convert_dict_unittest.cc @@ -114,7 +114,17 @@ void RunDictionaryTest(const char* codepage, writer.SetOtherCommands(aff_reader.other_commands()); writer.SetWords(dic_reader.words()); - VerifyWords(dic_reader.words(), writer.GetBDict()); + std::string bdict_data = writer.GetBDict(); + VerifyWords(dic_reader.words(), bdict_data); + EXPECT_TRUE(hunspell::BDict::Verify(bdict_data.data(), bdict_data.size())); + + // Trim the end of this BDICT and verify our verifier tells these trimmed + // BDICTs are corrupted. + for (size_t i = 1; i < bdict_data.size(); ++i) { + SCOPED_TRACE(StringPrintf("i = %" PRIuS, i)); + EXPECT_FALSE(hunspell::BDict::Verify(bdict_data.data(), + bdict_data.size() - i)); + } } // Deletes the temporary files. |