remote_device_test_util.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_COMPONENTS_MULTIDEVICE_REMOTE_DEVICE_TEST_UTIL_H_
  5. #define ASH_COMPONENTS_MULTIDEVICE_REMOTE_DEVICE_TEST_UTIL_H_
  6. #include <memory>
  7. #include <string>
  8. #include <vector>
  9. #include "ash/components/multidevice/remote_device_ref.h"
  10. namespace ash::multidevice {
  11. // Attributes of the default test remote device.
  12. extern const char kTestRemoteDeviceName[];
  13. extern const char kTestRemoteDevicePublicKey[];
  14. extern const char kTestRemoteDeviceBluetoothPublicAddress[];
  15. class RemoteDeviceRefBuilder {
  16. public:
  17. RemoteDeviceRefBuilder();
  18. ~RemoteDeviceRefBuilder();
  19. RemoteDeviceRefBuilder& SetUserEmail(const std::string& user_email);
  20. RemoteDeviceRefBuilder& SetInstanceId(const std::string& instance_id);
  21. RemoteDeviceRefBuilder& SetName(const std::string& name);
  22. RemoteDeviceRefBuilder& SetPiiFreeName(const std::string& pii_free_name);
  23. RemoteDeviceRefBuilder& SetPublicKey(const std::string& public_key);
  24. RemoteDeviceRefBuilder& SetSupportsMobileHotspot(
  25. bool supports_mobile_hotspot);
  26. RemoteDeviceRefBuilder& SetSoftwareFeatureState(
  27. const SoftwareFeature feature,
  28. const SoftwareFeatureState new_state);
  29. RemoteDeviceRefBuilder& SetLastUpdateTimeMillis(
  30. int64_t last_update_time_millis);
  31. RemoteDeviceRefBuilder& SetBeaconSeeds(
  32. const std::vector<BeaconSeed>& beacon_seeds);
  33. RemoteDeviceRefBuilder& SetBluetoothPublicAddress(
  34. const std::string& bluetooth_public_address);
  35. RemoteDeviceRef Build();
  36. private:
  37. std::shared_ptr<RemoteDevice> remote_device_;
  38. };
  39. RemoteDevice CreateRemoteDeviceForTest();
  40. RemoteDeviceRef CreateRemoteDeviceRefForTest();
  41. RemoteDeviceList CreateRemoteDeviceListForTest(size_t num_to_create);
  42. RemoteDeviceRefList CreateRemoteDeviceRefListForTest(size_t num_to_create);
  43. RemoteDevice* GetMutableRemoteDevice(const RemoteDeviceRef& remote_device_ref);
  44. bool IsSameDevice(const RemoteDevice& remote_device,
  45. RemoteDeviceRef remote_device_ref);
  46. } // namespace ash::multidevice
  47. // TODO(https://crbug.com/1164001): remove after the //chrome/browser/chromeos
  48. // source migration is finished.
  49. namespace chromeos::multidevice {
  50. using ::ash::multidevice::CreateRemoteDeviceListForTest;
  51. using ::ash::multidevice::CreateRemoteDeviceRefForTest;
  52. using ::ash::multidevice::CreateRemoteDeviceRefListForTest;
  53. } // namespace chromeos::multidevice
  54. #endif // ASH_COMPONENTS_MULTIDEVICE_REMOTE_DEVICE_TEST_UTIL_H_