fake_message_sender.cc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. // Copyright 2020 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. #include "ash/components/phonehub/fake_message_sender.h"
  5. namespace ash {
  6. namespace phonehub {
  7. FakeMessageSender::FakeMessageSender() = default;
  8. FakeMessageSender::~FakeMessageSender() = default;
  9. void FakeMessageSender::SendCrosState(bool notification_enabled,
  10. bool camera_roll_enabled) {
  11. cros_states_.push_back(
  12. std::make_pair(notification_enabled, camera_roll_enabled));
  13. }
  14. void FakeMessageSender::SendUpdateNotificationModeRequest(
  15. bool do_not_disturb_enabled) {
  16. update_notification_mode_requests_.push_back(do_not_disturb_enabled);
  17. }
  18. void FakeMessageSender::SendUpdateBatteryModeRequest(
  19. bool battery_saver_mode_enabled) {
  20. update_battery_mode_requests_.push_back(battery_saver_mode_enabled);
  21. }
  22. void FakeMessageSender::SendDismissNotificationRequest(
  23. int64_t notification_id) {
  24. dismiss_notification_requests_.push_back(notification_id);
  25. }
  26. void FakeMessageSender::SendNotificationInlineReplyRequest(
  27. int64_t notification_id,
  28. const std::u16string& reply_text) {
  29. notification_inline_reply_requests_.push_back(
  30. std::make_pair(notification_id, reply_text));
  31. }
  32. void FakeMessageSender::SendShowNotificationAccessSetupRequest() {
  33. show_notification_access_setup_count_++;
  34. }
  35. void FakeMessageSender::SendRingDeviceRequest(bool device_ringing_enabled) {
  36. ring_device_requests_.push_back(device_ringing_enabled);
  37. }
  38. void FakeMessageSender::SendFetchCameraRollItemsRequest(
  39. const proto::FetchCameraRollItemsRequest& request) {
  40. fetch_camera_roll_items_requests_.push_back(request);
  41. }
  42. void FakeMessageSender::SendFetchCameraRollItemDataRequest(
  43. const proto::FetchCameraRollItemDataRequest& request) {
  44. fetch_camera_roll_item_data_requests_.push_back(request);
  45. }
  46. void FakeMessageSender::SendInitiateCameraRollItemTransferRequest(
  47. const proto::InitiateCameraRollItemTransferRequest& request) {
  48. initiate_camera_roll_item_transfer_requests_.push_back(request);
  49. }
  50. void FakeMessageSender::SendFeatureSetupRequest(bool camera_roll,
  51. bool notifications) {
  52. feature_setup_requests_.push_back(std::make_pair(camera_roll, notifications));
  53. }
  54. size_t FakeMessageSender::GetCrosStateCallCount() const {
  55. return cros_states_.size();
  56. }
  57. size_t FakeMessageSender::GetUpdateNotificationModeRequestCallCount() const {
  58. return update_notification_mode_requests_.size();
  59. }
  60. size_t FakeMessageSender::GetUpdateBatteryModeRequestCallCount() const {
  61. return update_battery_mode_requests_.size();
  62. }
  63. size_t FakeMessageSender::GetDismissNotificationRequestCallCount() const {
  64. return dismiss_notification_requests_.size();
  65. }
  66. size_t FakeMessageSender::GetNotificationInlineReplyRequestCallCount() const {
  67. return notification_inline_reply_requests_.size();
  68. }
  69. size_t FakeMessageSender::GetRingDeviceRequestCallCount() const {
  70. return ring_device_requests_.size();
  71. }
  72. size_t FakeMessageSender::GetFetchCameraRollItemsRequestCallCount() const {
  73. return fetch_camera_roll_items_requests_.size();
  74. }
  75. size_t FakeMessageSender::GetFetchCameraRollItemDataRequestCallCount() const {
  76. return fetch_camera_roll_item_data_requests_.size();
  77. }
  78. size_t FakeMessageSender::GetInitiateCameraRollItemTransferRequestCallCount()
  79. const {
  80. return initiate_camera_roll_item_transfer_requests_.size();
  81. }
  82. size_t FakeMessageSender::GetFeatureSetupRequestCallCount() const {
  83. return feature_setup_requests_.size();
  84. }
  85. std::pair<bool, bool> FakeMessageSender::GetRecentCrosState() const {
  86. return cros_states_.back();
  87. }
  88. bool FakeMessageSender::GetRecentUpdateNotificationModeRequest() const {
  89. return update_notification_mode_requests_.back();
  90. }
  91. bool FakeMessageSender::GetRecentUpdateBatteryModeRequest() const {
  92. return update_battery_mode_requests_.back();
  93. }
  94. int64_t FakeMessageSender::GetRecentDismissNotificationRequest() const {
  95. return dismiss_notification_requests_.back();
  96. }
  97. const std::pair<int64_t, std::u16string>
  98. FakeMessageSender::GetRecentNotificationInlineReplyRequest() const {
  99. return notification_inline_reply_requests_.back();
  100. }
  101. bool FakeMessageSender::GetRecentRingDeviceRequest() const {
  102. return ring_device_requests_.back();
  103. }
  104. const proto::FetchCameraRollItemsRequest&
  105. FakeMessageSender::GetRecentFetchCameraRollItemsRequest() const {
  106. return fetch_camera_roll_items_requests_.back();
  107. }
  108. const proto::FetchCameraRollItemDataRequest&
  109. FakeMessageSender::GetRecentFetchCameraRollItemDataRequest() const {
  110. return fetch_camera_roll_item_data_requests_.back();
  111. }
  112. const proto::InitiateCameraRollItemTransferRequest&
  113. FakeMessageSender::GetRecentInitiateCameraRollItemTransferRequest() const {
  114. return initiate_camera_roll_item_transfer_requests_.back();
  115. }
  116. std::pair<bool, bool> FakeMessageSender::GetRecentFeatureSetupRequest() const {
  117. return feature_setup_requests_.back();
  118. }
  119. } // namespace phonehub
  120. } // namespace ash