| OLD | NEW |
| 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/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/metrics/histogram_samples.h" | 10 #include "base/metrics/histogram_samples.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 public: | 147 public: |
| 148 explicit SyncErrorFactoryStub(int* error_counter) | 148 explicit SyncErrorFactoryStub(int* error_counter) |
| 149 : error_counter_(error_counter) {} | 149 : error_counter_(error_counter) {} |
| 150 virtual ~SyncErrorFactoryStub() {} | 150 virtual ~SyncErrorFactoryStub() {} |
| 151 | 151 |
| 152 // Overridden from syncer::SyncErrorFactory: | 152 // Overridden from syncer::SyncErrorFactory: |
| 153 virtual syncer::SyncError CreateAndUploadError( | 153 virtual syncer::SyncError CreateAndUploadError( |
| 154 const tracked_objects::Location& location, | 154 const tracked_objects::Location& location, |
| 155 const std::string& message) OVERRIDE { | 155 const std::string& message) OVERRIDE { |
| 156 (*error_counter_)++; | 156 (*error_counter_)++; |
| 157 return syncer::SyncError(location, message, syncer::DICTIONARY); | 157 return syncer::SyncError(location, |
| 158 syncer::SyncError::DATATYPE_ERROR, |
| 159 message, |
| 160 syncer::DICTIONARY); |
| 158 } | 161 } |
| 159 | 162 |
| 160 private: | 163 private: |
| 161 int* error_counter_; | 164 int* error_counter_; |
| 162 DISALLOW_COPY_AND_ASSIGN(SyncErrorFactoryStub); | 165 DISALLOW_COPY_AND_ASSIGN(SyncErrorFactoryStub); |
| 163 }; | 166 }; |
| 164 | 167 |
| 165 // Counts the number of notifications for dictionary load and change. | 168 // Counts the number of notifications for dictionary load and change. |
| 166 class DictionaryObserverCounter : public SpellcheckCustomDictionary::Observer { | 169 class DictionaryObserverCounter : public SpellcheckCustomDictionary::Observer { |
| 167 public: | 170 public: |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 SpellcheckServiceFactory::GetForProfile(profile_.get()); | 1128 SpellcheckServiceFactory::GetForProfile(profile_.get()); |
| 1126 SpellcheckCustomDictionary* custom_dictionary = | 1129 SpellcheckCustomDictionary* custom_dictionary = |
| 1127 spellcheck_service->GetCustomDictionary(); | 1130 spellcheck_service->GetCustomDictionary(); |
| 1128 OnLoaded(*custom_dictionary, WordList()); | 1131 OnLoaded(*custom_dictionary, WordList()); |
| 1129 EXPECT_FALSE(custom_dictionary->HasWord("foo")); | 1132 EXPECT_FALSE(custom_dictionary->HasWord("foo")); |
| 1130 EXPECT_FALSE(custom_dictionary->HasWord("bar")); | 1133 EXPECT_FALSE(custom_dictionary->HasWord("bar")); |
| 1131 custom_dictionary->AddWord("foo"); | 1134 custom_dictionary->AddWord("foo"); |
| 1132 EXPECT_TRUE(custom_dictionary->HasWord("foo")); | 1135 EXPECT_TRUE(custom_dictionary->HasWord("foo")); |
| 1133 EXPECT_FALSE(custom_dictionary->HasWord("bar")); | 1136 EXPECT_FALSE(custom_dictionary->HasWord("bar")); |
| 1134 } | 1137 } |
| OLD | NEW |