1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
ash / public / cpp / test / test_desk_profiles_delegate.h [blame]
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_PUBLIC_CPP_TEST_TEST_DESK_PROFILES_DELEGATE_H_
#define ASH_PUBLIC_CPP_TEST_TEST_DESK_PROFILES_DELEGATE_H_
#include <vector>
#include "ash/public/cpp/ash_public_export.h"
#include "ash/public/cpp/desk_profiles_delegate.h"
#include "base/observer_list.h"
namespace ash {
class ASH_PUBLIC_EXPORT TestDeskProfilesDelegate : public DeskProfilesDelegate {
public:
TestDeskProfilesDelegate();
TestDeskProfilesDelegate(TestDeskProfilesDelegate&) = delete;
TestDeskProfilesDelegate& operator=(TestDeskProfilesDelegate&) = delete;
~TestDeskProfilesDelegate() override;
// Function to add fake profile. Note: This will invoke
// Observer::OnProfileUpsert.
void UpdateTestProfile(LacrosProfileSummary profile);
// Removes profile by `profile_id`, if profile can't be found, return
// false. Note: this will invoke Observer::OnProfileRemoved.
bool RemoveTestProfile(uint64_t profile_id);
// Set `primary_user_profile_id_` by `profile_id`, if profile can't be found,
// return false.
bool SetPrimaryProfileByProfileId(uint64_t profile_id);
// DeskProfilesDelegate:
const std::vector<LacrosProfileSummary>& GetProfilesSnapshot() const override;
const LacrosProfileSummary* GetProfilesSnapshotByProfileId(
uint64_t profile_id) const override;
uint64_t GetPrimaryProfileId() const override;
void AddObserver(Observer* observer) override;
void RemoveObserver(Observer* observer) override;
private:
std::vector<LacrosProfileSummary> profiles_;
base::ObserverList<Observer> observers_;
uint64_t primary_user_profile_id_ = 0;
};
} // namespace ash
#endif // ASH_PUBLIC_CPP_TEST_TEST_DESK_PROFILES_DELEGATE_H_