fake_position_cache.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2018 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 SERVICES_DEVICE_GEOLOCATION_FAKE_POSITION_CACHE_H_
  5. #define SERVICES_DEVICE_GEOLOCATION_FAKE_POSITION_CACHE_H_
  6. #include <utility>
  7. #include <vector>
  8. #include "services/device/geolocation/position_cache.h"
  9. #include "services/device/public/mojom/geoposition.mojom.h"
  10. namespace device {
  11. class FakePositionCache : public PositionCache {
  12. public:
  13. FakePositionCache();
  14. FakePositionCache(const FakePositionCache&) = delete;
  15. FakePositionCache& operator=(const FakePositionCache&) = delete;
  16. ~FakePositionCache() override;
  17. void CachePosition(const WifiData& wifi_data,
  18. const mojom::Geoposition& position) override;
  19. const mojom::Geoposition* FindPosition(
  20. const WifiData& wifi_data) const override;
  21. size_t GetPositionCacheSize() const override;
  22. const mojom::Geoposition& GetLastUsedNetworkPosition() const override;
  23. void SetLastUsedNetworkPosition(const mojom::Geoposition& position) override;
  24. private:
  25. std::vector<std::pair<WifiData, mojom::Geoposition>> data;
  26. mojom::Geoposition last_used_position;
  27. };
  28. } // namespace device
  29. #endif // SERVICES_DEVICE_GEOLOCATION_FAKE_POSITION_CACHE_H_