#include <stddef.h>
#include <memory>
#include <utility>
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/storage/settings_sync_util.h"
#include "chrome/browser/extensions/api/storage/sync_storage_backend.h"
#include "chrome/browser/extensions/api/storage/sync_value_store_cache.h"
#include "chrome/browser/extensions/api/storage/syncable_settings_storage.h"
#include "chrome/test/base/testing_profile.h"
#include "components/sync/model/sync_change_processor.h"
#include "components/sync/test/sync_change_processor_wrapper_for_test.h"
#include "components/value_store/test_value_store_factory.h"
#include "components/value_store/testing_value_store.h"
#include "content/public/test/browser_task_environment.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/api/storage/backend_task_runner.h"
#include "extensions/browser/api/storage/settings_test_util.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/api/storage/value_store_util.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/event_router_factory.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/mock_extension_system.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/manifest.h"
#include "testing/gtest/include/gtest/gtest.h"
ValueStore;
namespace extensions {
namespace {
const ValueStore::WriteOptions DEFAULTS = …;
SettingSyncDataMultimap;
static std::string GetJson(const base::Value& value) { … }
testing::AssertionResult ValuesEq(
const char* _1, const char* _2,
const base::Value* expected,
const base::Value* actual) { … }
testing::AssertionResult SettingsEq(const char* _1,
const char* _2,
const base::Value::Dict& expected,
ValueStore::ReadResult actual) { … }
class MockSyncChangeProcessor : public syncer::SyncChangeProcessor { … };
std::unique_ptr<KeyedService> MockExtensionSystemFactoryFunction(
content::BrowserContext* context) { … }
std::unique_ptr<KeyedService> BuildEventRouter(
content::BrowserContext* profile) { … }
}
class ExtensionSettingsSyncTest : public testing::Test { … };
TEST_F(ExtensionSettingsSyncTest, NoDataDoesNotInvokeSync) { … }
TEST_F(ExtensionSettingsSyncTest, InSyncDataDoesNotInvokeSync) { … }
TEST_F(ExtensionSettingsSyncTest, LocalDataWithNoSyncDataIsPushedToSync) { … }
TEST_F(ExtensionSettingsSyncTest, AnySyncDataOverwritesLocalData) { … }
TEST_F(ExtensionSettingsSyncTest, ProcessSyncChanges) { … }
TEST_F(ExtensionSettingsSyncTest, PushToSync) { … }
TEST_F(ExtensionSettingsSyncTest, ExtensionAndAppSettingsSyncSeparately) { … }
TEST_F(ExtensionSettingsSyncTest, FailingStartSyncingDisablesSync) { … }
TEST_F(ExtensionSettingsSyncTest, FailingProcessChangesDisablesSync) { … }
TEST_F(ExtensionSettingsSyncTest, FailingGetAllSyncDataDoesntStopSync) { … }
TEST_F(ExtensionSettingsSyncTest, FailureToReadChangesToPushDisablesSync) { … }
TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalStateDisablesSync) { … }
TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalChangeDisablesSync) { … }
TEST_F(ExtensionSettingsSyncTest,
LargeOutgoingChangeRejectedButIncomingAccepted) { … }
TEST_F(ExtensionSettingsSyncTest, Dots) { … }
namespace {
static void UnlimitedSyncStorageTestCallback(ValueStore* sync_storage) { … }
static void UnlimitedLocalStorageTestCallback(ValueStore* local_storage) { … }
}
TEST_F(ExtensionSettingsSyncTest, UnlimitedStorageForLocalButNotSync) { … }
}