mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Create fake notification controller observer for further testing in presenter and ui_broker.
PiperOrigin-RevId: 516907638
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
// Copyright 2023 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef THIRD_PARTY_NEARBY_FASTPAIR_UI_FAST_PAIR_FAKE_FAST_PAIR_NOTIFICATION_CONTROLLER_OBSERVER_H_
|
||||
#define THIRD_PARTY_NEARBY_FASTPAIR_UI_FAST_PAIR_FAKE_FAST_PAIR_NOTIFICATION_CONTROLLER_OBSERVER_H_
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "fastpair/repository/device_metadata.h"
|
||||
#include "fastpair/ui/fast_pair/fast_pair_notification_controller.h"
|
||||
|
||||
namespace nearby {
|
||||
namespace fastpair {
|
||||
class FakeFastPairNotificationControllerObserver
|
||||
: public FastPairNotificationController::Observer {
|
||||
public:
|
||||
void OnUpdateDevice(DeviceMetadata& device) override {
|
||||
device_metadata_name_list_.push_back(device.GetDetails().name());
|
||||
on_update_device_count_++;
|
||||
}
|
||||
|
||||
bool CheckDeviceMetadataListContainTestDevice(
|
||||
const std::string& device_name) {
|
||||
auto it = std::find(device_metadata_name_list_.begin(),
|
||||
device_metadata_name_list_.end(), device_name);
|
||||
return it != device_metadata_name_list_.end();
|
||||
}
|
||||
|
||||
int on_update_device_count() { return on_update_device_count_; }
|
||||
|
||||
std::vector<std::string> device_metadata_name_list() {
|
||||
return device_metadata_name_list_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::string> device_metadata_name_list_;
|
||||
int on_update_device_count_ = 0;
|
||||
};
|
||||
} // namespace fastpair
|
||||
} // namespace nearby
|
||||
|
||||
#endif // THIRD_PARTY_NEARBY_FASTPAIR_UI_FAST_PAIR_FAKE_FAST_PAIR_NOTIFICATION_CONTROLLER_OBSERVER_H_
|
||||
Reference in New Issue
Block a user