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
ash / components / arc / test / fake_volume_mounter_instance.h [blame]
// Copyright 2023 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_COMPONENTS_ARC_TEST_FAKE_VOLUME_MOUNTER_INSTANCE_H_
#define ASH_COMPONENTS_ARC_TEST_FAKE_VOLUME_MOUNTER_INSTANCE_H_
#include <map>
#include <string>
#include "ash/components/arc/mojom/volume_mounter.mojom.h"
#include "base/containers/queue.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/cros_system_api/dbus/cros-disks/dbus-constants.h"
namespace arc {
class FakeVolumeMounterInstance : public mojom::VolumeMounterInstance {
public:
FakeVolumeMounterInstance();
FakeVolumeMounterInstance(const FakeVolumeMounterInstance&) = delete;
FakeVolumeMounterInstance& operator=(const FakeVolumeMounterInstance&) =
delete;
~FakeVolumeMounterInstance() override;
int num_on_mount_event_called() { return num_on_mount_event_called_; }
mojom::MountPointInfoPtr GetMountPointInfo(const std::string& mount_path);
// Runs the oldest callback in `callbacks_` with `success`.
void RunCallback(bool success);
// mojom::VolumeMounterInstance overrides:
void Init(::mojo::PendingRemote<mojom::VolumeMounterHost> host_remote,
InitCallback callback) override;
void OnMountEvent(mojom::MountPointInfoPtr mount_point_info) override;
void PrepareForRemovableMediaUnmount(
const base::FilePath& mount_path,
PrepareForRemovableMediaUnmountCallback callback) override;
private:
mojo::Remote<mojom::VolumeMounterHost> host_remote_;
int num_on_mount_event_called_ = 0;
std::map<std::string, mojom::MountPointInfoPtr> mount_path_to_info_;
base::queue<PrepareForRemovableMediaUnmountCallback> callbacks_;
};
} // namespace arc
#endif // ASH_COMPONENTS_ARC_TEST_FAKE_VOLUME_MOUNTER_INSTANCE_H_