fake_account_status_change_delegate.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 ASH_SERVICES_MULTIDEVICE_SETUP_FAKE_ACCOUNT_STATUS_CHANGE_DELEGATE_H_
  5. #define ASH_SERVICES_MULTIDEVICE_SETUP_FAKE_ACCOUNT_STATUS_CHANGE_DELEGATE_H_
  6. #include "ash/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h"
  7. #include "mojo/public/cpp/bindings/pending_remote.h"
  8. #include "mojo/public/cpp/bindings/receiver_set.h"
  9. namespace ash {
  10. namespace multidevice_setup {
  11. // Fake mojom::AccountStatusChangeDelegate implementation for tests.
  12. class FakeAccountStatusChangeDelegate
  13. : public mojom::AccountStatusChangeDelegate {
  14. public:
  15. FakeAccountStatusChangeDelegate();
  16. FakeAccountStatusChangeDelegate(const FakeAccountStatusChangeDelegate&) =
  17. delete;
  18. FakeAccountStatusChangeDelegate& operator=(
  19. const FakeAccountStatusChangeDelegate&) = delete;
  20. ~FakeAccountStatusChangeDelegate() override;
  21. mojo::PendingRemote<mojom::AccountStatusChangeDelegate> GenerateRemote();
  22. size_t num_new_user_potential_host_events_handled() const {
  23. return num_new_user_potential_host_events_handled_;
  24. }
  25. size_t num_no_longer_new_user_events_handled() const {
  26. return num_no_longer_new_user_events_handled_;
  27. }
  28. size_t num_existing_user_host_switched_events_handled() const {
  29. return num_existing_user_host_switched_events_handled_;
  30. }
  31. size_t num_existing_user_chromebook_added_events_handled() const {
  32. return num_existing_user_chromebook_added_events_handled_;
  33. }
  34. size_t num_eligible_for_wifi_sync_events_handled() const {
  35. return num_eligible_for_wifi_sync_events_handled_;
  36. }
  37. // mojom::AccountStatusChangeDelegate:
  38. void OnPotentialHostExistsForNewUser() override;
  39. void OnNoLongerNewUser() override;
  40. void OnConnectedHostSwitchedForExistingUser(
  41. const std::string& new_host_device_name) override;
  42. void OnNewChromebookAddedForExistingUser(
  43. const std::string& new_host_device_name) override;
  44. void OnBecameEligibleForWifiSync() override;
  45. private:
  46. size_t num_new_user_potential_host_events_handled_ = 0u;
  47. size_t num_no_longer_new_user_events_handled_ = 0u;
  48. size_t num_existing_user_host_switched_events_handled_ = 0u;
  49. size_t num_existing_user_chromebook_added_events_handled_ = 0u;
  50. size_t num_eligible_for_wifi_sync_events_handled_ = 0u;
  51. mojo::ReceiverSet<mojom::AccountStatusChangeDelegate> receivers_;
  52. };
  53. } // namespace multidevice_setup
  54. } // namespace ash
  55. #endif // ASH_SERVICES_MULTIDEVICE_SETUP_FAKE_ACCOUNT_STATUS_CHANGE_DELEGATE_H_