OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/i18n/icu_string_conversions.h" | 10 #include "base/i18n/icu_string_conversions.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 codepage, | 74 codepage, |
75 base::OnStringConversionError::FAIL, | 75 base::OnStringConversionError::FAIL, |
76 &encoded_word)); | 76 &encoded_word)); |
77 dic_data += encoded_word; | 77 dic_data += encoded_word; |
78 dic_data += "\n"; | 78 dic_data += "\n"; |
79 } | 79 } |
80 | 80 |
81 // Create a temporary affix file and a dictionary file from the test data. | 81 // Create a temporary affix file and a dictionary file from the test data. |
82 base::FilePath aff_file; | 82 base::FilePath aff_file; |
83 base::CreateTemporaryFile(&aff_file); | 83 base::CreateTemporaryFile(&aff_file); |
84 file_util::WriteFile(aff_file, aff_data.c_str(), aff_data.length()); | 84 base::WriteFile(aff_file, aff_data.c_str(), aff_data.length()); |
85 | 85 |
86 base::FilePath dic_file; | 86 base::FilePath dic_file; |
87 base::CreateTemporaryFile(&dic_file); | 87 base::CreateTemporaryFile(&dic_file); |
88 file_util::WriteFile(dic_file, dic_data.c_str(), dic_data.length()); | 88 base::WriteFile(dic_file, dic_data.c_str(), dic_data.length()); |
89 | 89 |
90 { | 90 { |
91 // Read the above affix file with AffReader and read the dictionary file | 91 // Read the above affix file with AffReader and read the dictionary file |
92 // with DicReader, respectively. | 92 // with DicReader, respectively. |
93 convert_dict::AffReader aff_reader(aff_file); | 93 convert_dict::AffReader aff_reader(aff_file); |
94 EXPECT_TRUE(aff_reader.Read()); | 94 EXPECT_TRUE(aff_reader.Read()); |
95 | 95 |
96 convert_dict::DicReader dic_reader(dic_file); | 96 convert_dict::DicReader dic_reader(dic_file); |
97 EXPECT_TRUE(dic_reader.Read(&aff_reader)); | 97 EXPECT_TRUE(dic_reader.Read(&aff_reader)); |
98 | 98 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 }; | 198 }; |
199 | 199 |
200 std::map<base::string16, bool> word_list; | 200 std::map<base::string16, bool> word_list; |
201 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kWords); ++i) | 201 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kWords); ++i) |
202 word_list.insert( | 202 word_list.insert( |
203 std::make_pair<base::string16, bool>(base::WideToUTF16(kWords[i]), | 203 std::make_pair<base::string16, bool>(base::WideToUTF16(kWords[i]), |
204 true)); | 204 true)); |
205 | 205 |
206 RunDictionaryTest(kCodepage, word_list); | 206 RunDictionaryTest(kCodepage, word_list); |
207 } | 207 } |
OLD | NEW |