fake_camera_roll_manager.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2021 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_PHONEHUB_FAKE_CAMERA_ROLL_MANAGER_H_
  5. #define ASH_COMPONENTS_PHONEHUB_FAKE_CAMERA_ROLL_MANAGER_H_
  6. #include "ash/components/phonehub/camera_roll_manager.h"
  7. #include "ash/components/phonehub/proto/phonehub_api.pb.h"
  8. namespace ash {
  9. namespace phonehub {
  10. class FakeCameraRollManager : public CameraRollManager {
  11. public:
  12. FakeCameraRollManager();
  13. ~FakeCameraRollManager() override;
  14. void SetIsCameraRollAvailableToBeEnabled(bool can_enable);
  15. void SetIsCameraRollAccessible(bool accessiable);
  16. void SetIsAndroidStorageGranted(bool granted);
  17. void SetSimulatedDownloadError(bool has_error);
  18. void SetSimulatedErrorType(Observer::DownloadErrorType error_type);
  19. int GetDownloadRequestCount();
  20. bool is_camera_roll_enabled() const { return !is_avaiable_to_be_enabled_; }
  21. using CameraRollManager::SetCurrentItems;
  22. using CameraRollManager::ClearCurrentItems;
  23. private:
  24. void ComputeAndUpdateUiState() override;
  25. // CameraRollManager:
  26. void DownloadItem(
  27. const proto::CameraRollItemMetadata& item_metadata) override;
  28. int download_request_count_ = 0;
  29. bool is_avaiable_to_be_enabled_ = true;
  30. bool is_camera_roll_accessible_ = true;
  31. bool is_android_storage_granted_ = true;
  32. bool is_simulating_error_ = false;
  33. Observer::DownloadErrorType simulated_error_type_ =
  34. Observer::DownloadErrorType::kGenericError;
  35. };
  36. } // namespace phonehub
  37. } // namespace ash
  38. #endif // ASH_COMPONENTS_PHONEHUB_FAKE_CAMERA_ROLL_MANAGER_H_