| 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/files/file_util.h" | 7 #include "base/files/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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 static KeyedService* BuildSpellcheckService(content::BrowserContext* profile) { | 60 static KeyedService* BuildSpellcheckService(content::BrowserContext* profile) { |
| 61 return new SpellcheckService(static_cast<Profile*>(profile)); | 61 return new SpellcheckService(static_cast<Profile*>(profile)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 class SpellcheckCustomDictionaryTest : public testing::Test { | 64 class SpellcheckCustomDictionaryTest : public testing::Test { |
| 65 protected: | 65 protected: |
| 66 virtual void SetUp() override { | 66 void SetUp() override { |
| 67 // Use SetTestingFactoryAndUse to force creation and initialization. | 67 // Use SetTestingFactoryAndUse to force creation and initialization. |
| 68 SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 68 SpellcheckServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 69 &profile_, &BuildSpellcheckService); | 69 &profile_, &BuildSpellcheckService); |
| 70 | 70 |
| 71 StatisticsRecorder::Initialize(); | 71 StatisticsRecorder::Initialize(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // A wrapper around SpellcheckCustomDictionary::LoadDictionaryFile private | 74 // A wrapper around SpellcheckCustomDictionary::LoadDictionaryFile private |
| 75 // function to avoid a large number of FRIEND_TEST declarations in | 75 // function to avoid a large number of FRIEND_TEST declarations in |
| 76 // SpellcheckCustomDictionary. | 76 // SpellcheckCustomDictionary. |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1169 SpellcheckServiceFactory::GetForContext(&profile_); | 1169 SpellcheckServiceFactory::GetForContext(&profile_); |
| 1170 SpellcheckCustomDictionary* custom_dictionary = | 1170 SpellcheckCustomDictionary* custom_dictionary = |
| 1171 spellcheck_service->GetCustomDictionary(); | 1171 spellcheck_service->GetCustomDictionary(); |
| 1172 OnLoaded(*custom_dictionary, WordList()); | 1172 OnLoaded(*custom_dictionary, WordList()); |
| 1173 EXPECT_FALSE(custom_dictionary->HasWord("foo")); | 1173 EXPECT_FALSE(custom_dictionary->HasWord("foo")); |
| 1174 EXPECT_FALSE(custom_dictionary->HasWord("bar")); | 1174 EXPECT_FALSE(custom_dictionary->HasWord("bar")); |
| 1175 custom_dictionary->AddWord("foo"); | 1175 custom_dictionary->AddWord("foo"); |
| 1176 EXPECT_TRUE(custom_dictionary->HasWord("foo")); | 1176 EXPECT_TRUE(custom_dictionary->HasWord("foo")); |
| 1177 EXPECT_FALSE(custom_dictionary->HasWord("bar")); | 1177 EXPECT_FALSE(custom_dictionary->HasWord("bar")); |
| 1178 } | 1178 } |
| OLD | NEW |