mock_removable_storage_observer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2014 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 COMPONENTS_STORAGE_MONITOR_MOCK_REMOVABLE_STORAGE_OBSERVER_H_
  5. #define COMPONENTS_STORAGE_MONITOR_MOCK_REMOVABLE_STORAGE_OBSERVER_H_
  6. #include "components/storage_monitor/removable_storage_observer.h"
  7. #include "components/storage_monitor/storage_info.h"
  8. namespace storage_monitor {
  9. class MockRemovableStorageObserver : public RemovableStorageObserver {
  10. public:
  11. MockRemovableStorageObserver();
  12. ~MockRemovableStorageObserver() override;
  13. void OnRemovableStorageAttached(const StorageInfo& info) override;
  14. void OnRemovableStorageDetached(const StorageInfo& info) override;
  15. int attach_calls() { return attach_calls_; }
  16. int detach_calls() { return detach_calls_; }
  17. const StorageInfo& last_attached() {
  18. return last_attached_;
  19. }
  20. const StorageInfo& last_detached() {
  21. return last_detached_;
  22. }
  23. private:
  24. int attach_calls_;
  25. int detach_calls_;
  26. StorageInfo last_attached_;
  27. StorageInfo last_detached_;
  28. };
  29. } // namespace storage_monitor
  30. #endif // COMPONENTS_STORAGE_MONITOR_MOCK_REMOVABLE_STORAGE_OBSERVER_H_