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

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

Issue 217063005: Separate SyncData methods into three groups, local, remote, and common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@syncapi
Patch Set: Reorganize Local and Remote based on offline feedback. Created 6 years, 8 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
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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 EXPECT_TRUE(dictionary->AddWord("foo")); 304 EXPECT_TRUE(dictionary->AddWord("foo"));
305 305
306 data = dictionary->GetAllSyncData(syncer::DICTIONARY); 306 data = dictionary->GetAllSyncData(syncer::DICTIONARY);
307 EXPECT_EQ(2UL, data.size()); 307 EXPECT_EQ(2UL, data.size());
308 std::vector<std::string> words; 308 std::vector<std::string> words;
309 words.push_back("bar"); 309 words.push_back("bar");
310 words.push_back("foo"); 310 words.push_back("foo");
311 for (size_t i = 0; i < data.size(); i++) { 311 for (size_t i = 0; i < data.size(); i++) {
312 EXPECT_TRUE(data[i].GetSpecifics().has_dictionary()); 312 EXPECT_TRUE(data[i].GetSpecifics().has_dictionary());
313 EXPECT_EQ(syncer::DICTIONARY, data[i].GetDataType()); 313 EXPECT_EQ(syncer::DICTIONARY, data[i].GetDataType());
314 EXPECT_EQ(words[i], data[i].GetTag()); 314 EXPECT_EQ(words[i], data[i].AsLocal().GetTag());
315 EXPECT_EQ(words[i], data[i].GetSpecifics().dictionary().word()); 315 EXPECT_EQ(words[i], data[i].GetSpecifics().dictionary().word());
316 } 316 }
317 317
318 EXPECT_TRUE(dictionary->RemoveWord("bar")); 318 EXPECT_TRUE(dictionary->RemoveWord("bar"));
319 EXPECT_TRUE(dictionary->RemoveWord("foo")); 319 EXPECT_TRUE(dictionary->RemoveWord("foo"));
320 320
321 data = dictionary->GetAllSyncData(syncer::DICTIONARY); 321 data = dictionary->GetAllSyncData(syncer::DICTIONARY);
322 EXPECT_TRUE(data.empty()); 322 EXPECT_TRUE(data.empty());
323 } 323 }
324 324
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 SpellcheckServiceFactory::GetForContext(&profile_); 1167 SpellcheckServiceFactory::GetForContext(&profile_);
1168 SpellcheckCustomDictionary* custom_dictionary = 1168 SpellcheckCustomDictionary* custom_dictionary =
1169 spellcheck_service->GetCustomDictionary(); 1169 spellcheck_service->GetCustomDictionary();
1170 OnLoaded(*custom_dictionary, WordList()); 1170 OnLoaded(*custom_dictionary, WordList());
1171 EXPECT_FALSE(custom_dictionary->HasWord("foo")); 1171 EXPECT_FALSE(custom_dictionary->HasWord("foo"));
1172 EXPECT_FALSE(custom_dictionary->HasWord("bar")); 1172 EXPECT_FALSE(custom_dictionary->HasWord("bar"));
1173 custom_dictionary->AddWord("foo"); 1173 custom_dictionary->AddWord("foo");
1174 EXPECT_TRUE(custom_dictionary->HasWord("foo")); 1174 EXPECT_TRUE(custom_dictionary->HasWord("foo"));
1175 EXPECT_FALSE(custom_dictionary->HasWord("bar")); 1175 EXPECT_FALSE(custom_dictionary->HasWord("bar"));
1176 } 1176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698