Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Side by Side Diff: chrome/browser/spellchecker/spellcheck_custom_dictionary_unittest.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <vector> 5 #include <vector>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/metrics/histogram_samples.h" 8 #include "base/metrics/histogram_samples.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 WordList loaded_custom_words = LoadDictionaryFile(path); 298 WordList loaded_custom_words = LoadDictionaryFile(path);
299 WordList expected; 299 WordList expected;
300 expected.push_back("bar"); 300 expected.push_back("bar");
301 expected.push_back("foo"); 301 expected.push_back("foo");
302 EXPECT_EQ(expected, loaded_custom_words); 302 EXPECT_EQ(expected, loaded_custom_words);
303 303
304 SpellcheckCustomDictionary::Change change; 304 SpellcheckCustomDictionary::Change change;
305 change.AddWord("baz"); 305 change.AddWord("baz");
306 UpdateDictionaryFile(change, path); 306 UpdateDictionaryFile(change, path);
307 content.clear(); 307 content.clear();
308 file_util::ReadFileToString(path, &content); 308 base::ReadFileToString(path, &content);
309 content.append("corruption"); 309 content.append("corruption");
310 file_util::WriteFile(path, content.c_str(), content.length()); 310 file_util::WriteFile(path, content.c_str(), content.length());
311 loaded_custom_words = LoadDictionaryFile(path); 311 loaded_custom_words = LoadDictionaryFile(path);
312 EXPECT_EQ(expected, loaded_custom_words); 312 EXPECT_EQ(expected, loaded_custom_words);
313 } 313 }
314 314
315 TEST_F(SpellcheckCustomDictionaryTest, 315 TEST_F(SpellcheckCustomDictionaryTest,
316 GetAllSyncDataAccuratelyReflectsDictionaryState) { 316 GetAllSyncDataAccuratelyReflectsDictionaryState) {
317 SpellcheckCustomDictionary* dictionary = 317 SpellcheckCustomDictionary* dictionary =
318 SpellcheckServiceFactory::GetForProfile( 318 SpellcheckServiceFactory::GetForProfile(
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 SpellcheckServiceFactory::GetForProfile(&profile_); 1129 SpellcheckServiceFactory::GetForProfile(&profile_);
1130 SpellcheckCustomDictionary* custom_dictionary = 1130 SpellcheckCustomDictionary* custom_dictionary =
1131 spellcheck_service->GetCustomDictionary(); 1131 spellcheck_service->GetCustomDictionary();
1132 OnLoaded(*custom_dictionary, WordList()); 1132 OnLoaded(*custom_dictionary, WordList());
1133 EXPECT_FALSE(custom_dictionary->HasWord("foo")); 1133 EXPECT_FALSE(custom_dictionary->HasWord("foo"));
1134 EXPECT_FALSE(custom_dictionary->HasWord("bar")); 1134 EXPECT_FALSE(custom_dictionary->HasWord("bar"));
1135 custom_dictionary->AddWord("foo"); 1135 custom_dictionary->AddWord("foo");
1136 EXPECT_TRUE(custom_dictionary->HasWord("foo")); 1136 EXPECT_TRUE(custom_dictionary->HasWord("foo"));
1137 EXPECT_FALSE(custom_dictionary->HasWord("bar")); 1137 EXPECT_FALSE(custom_dictionary->HasWord("bar"));
1138 } 1138 }
OLDNEW
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_custom_dictionary.cc ('k') | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698