#include "components/segmentation_platform/internal/execution/processing/sync_device_info_observer.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/task_environment.h"
#include "components/segmentation_platform/internal/execution/processing/feature_processor_state.h"
#include "components/segmentation_platform/internal/metadata/metadata_writer.h"
#include "components/segmentation_platform/public/proto/model_metadata.pb.h"
#include "components/sync/protocol/sync_enums.pb.h"
#include "components/sync_device_info/device_info.h"
#include "components/sync_device_info/device_info_util.h"
#include "components/sync_device_info/fake_device_info_tracker.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace segmentation_platform::processing {
namespace {
#define AS_FLOAT_VAL(x) …
DeviceInfo;
OsType;
DeviceCountByOsTypeMap;
FakeDeviceInfoTracker;
DeviceType;
DeviceCountByOsTypeMap;
const sync_pb::SyncEnums_DeviceType kLocalDeviceType = …;
const DeviceInfo::OsType kLocalDeviceOS = …;
const DeviceInfo::FormFactor kLocalDeviceFormFactor = …;
std::unique_ptr<DeviceInfo> CreateDeviceInfo(
const std::string& guid,
DeviceType device_type,
OsType os_type,
base::Time last_updated = base::Time::Now()) { … }
scoped_refptr<InputContext> CreateInputContext() { … }
class SyncDeviceInfoObserverTest : public testing::Test { … };
TEST_F(SyncDeviceInfoObserverTest, OnDeviceInfoChange_LocalDevice) { … }
TEST_F(SyncDeviceInfoObserverTest, OnDeviceInfoChange_DifferentGuids) { … }
TEST_F(SyncDeviceInfoObserverTest, OnDeviceInfoChange_DifferentOS) { … }
TEST_F(SyncDeviceInfoObserverTest, OnDeviceInfoChange_InactiveDevice) { … }
TEST_F(SyncDeviceInfoObserverTest, AddingDeviceBeforeProcess) { … }
TEST_F(SyncDeviceInfoObserverTest,
ProcessWithTimeoutAndAddingDeviceWithoutWait) { … }
TEST_F(SyncDeviceInfoObserverTest, ProcessWithNoTimeout) { … }
TEST_F(SyncDeviceInfoObserverTest, ProcessWithNotIntegerTimeout) { … }
TEST_F(SyncDeviceInfoObserverTest, ProcessWithTimeoutBeforeAddingDevice) { … }
}
}