#include "chrome/browser/spellchecker/spellcheck_custom_dictionary.h"
#include <stddef.h>
#include <list>
#include <memory>
#include <utility>
#include <vector>
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_samples.h"
#include "base/metrics/statistics_recorder.h"
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/spellchecker/spellcheck_service.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/test/base/testing_profile.h"
#include "components/spellcheck/browser/spellcheck_host_metrics.h"
#include "components/spellcheck/common/spellcheck_common.h"
#include "components/sync/base/client_tag_hash.h"
#include "components/sync/model/sync_change.h"
#include "components/sync/model/sync_data.h"
#include "components/sync/protocol/dictionary_specifics.pb.h"
#include "components/sync/protocol/entity_specifics.pb.h"
#include "components/sync/test/sync_change_processor_wrapper_for_test.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "net/test/embedded_test_server/default_handlers.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
HistogramBase;
HistogramSamples;
StatisticsRecorder;
namespace {
syncer::SyncDataList GetAllSyncDataNoLimit(
const SpellcheckCustomDictionary* dictionary) { … }
}
static std::unique_ptr<KeyedService> BuildSpellcheckService(
content::BrowserContext* profile) { … }
class SpellcheckCustomDictionaryTest : public testing::Test { … };
class DictionaryObserverCounter : public SpellcheckCustomDictionary::Observer { … };
TEST_F(SpellcheckCustomDictionaryTest, SaveAndLoad) { … }
TEST_F(SpellcheckCustomDictionaryTest, MultiProfile) { … }
TEST_F(SpellcheckCustomDictionaryTest, LegacyEmptyDictionaryShouldBeConverted) { … }
TEST_F(SpellcheckCustomDictionaryTest,
LegacyDictionaryWithTwoWordsShouldBeConverted) { … }
TEST_F(SpellcheckCustomDictionaryTest,
IllegalWordsShouldBeRemovedFromDictionary) { … }
TEST_F(SpellcheckCustomDictionaryTest, CorruptedWriteShouldBeRecovered) { … }
TEST_F(SpellcheckCustomDictionaryTest,
GetAllSyncDataAccuratelyReflectsDictionaryState) { … }
TEST_F(SpellcheckCustomDictionaryTest, GetAllSyncDataHasLimit) { … }
TEST_F(SpellcheckCustomDictionaryTest, ProcessSyncChanges) { … }
TEST_F(SpellcheckCustomDictionaryTest, MergeDataAndStartSyncing) { … }
TEST_F(SpellcheckCustomDictionaryTest, SyncBeforeLoadDoesNotDuplicateWords) { … }
TEST_F(SpellcheckCustomDictionaryTest, DictionaryTooBigBeforeSyncing) { … }
TEST_F(SpellcheckCustomDictionaryTest, DictionaryTooBigAndServerFull) { … }
TEST_F(SpellcheckCustomDictionaryTest, ServerTooBig) { … }
TEST_F(SpellcheckCustomDictionaryTest, DictionaryTooBigToStartSyncing) { … }
TEST_F(SpellcheckCustomDictionaryTest, DictionaryTooBigToContiueSyncing) { … }
TEST_F(SpellcheckCustomDictionaryTest, LoadAfterSyncStart) { … }
TEST_F(SpellcheckCustomDictionaryTest, LoadAfterSyncStartTooBigToSync) { … }
TEST_F(SpellcheckCustomDictionaryTest, LoadDuplicatesAfterSync) { … }
TEST_F(SpellcheckCustomDictionaryTest, DictionaryLoadNotification) { … }
TEST_F(SpellcheckCustomDictionaryTest, DictionaryAddWordNotification) { … }
TEST_F(SpellcheckCustomDictionaryTest, DictionaryRemoveWordNotification) { … }
TEST_F(SpellcheckCustomDictionaryTest, DictionarySyncNotification) { … }
TEST_F(SpellcheckCustomDictionaryTest, DictionarySyncLimit) { … }
TEST_F(SpellcheckCustomDictionaryTest, HasWord) { … }