-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
esim_test_base.h
87 lines (66 loc) · 2.85 KB
/
esim_test_base.h
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_SERVICES_CELLULAR_SETUP_ESIM_TEST_BASE_H_
#define CHROMEOS_SERVICES_CELLULAR_SETUP_ESIM_TEST_BASE_H_
#include "base/test/task_environment.h"
#include "chromeos/services/cellular_setup/public/cpp/esim_manager_test_observer.h"
#include "chromeos/services/cellular_setup/public/mojom/esim_manager.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
class CellularInhibitor;
class NetworkStateHandler;
class NetworkDeviceHandler;
class NetworkConfigurationHandler;
class FakeNetworkConnectionHandler;
class CellularConnectionHandler;
class CellularESimUninstallHandler;
class CellularESimProfileHandler;
namespace cellular_setup {
class ESimManager;
// Base class for testing eSIM mojo impl classes.
class ESimTestBase : public testing::Test {
public:
static const char* kTestEuiccPath;
static const char* kTestEid;
// testing::Test:
void SetUp() override;
void TearDown() override;
// Creates a test euicc.
void SetupEuicc();
// Returns list of available euiccs under the test ESimManager.
std::vector<mojo::PendingRemote<mojom::Euicc>> GetAvailableEuiccs();
// Returns euicc with given |eid| under the test ESimManager.
mojo::Remote<mojom::Euicc> GetEuiccForEid(const std::string& eid);
protected:
ESimTestBase();
~ESimTestBase() override;
void FastForwardProfileRefreshDelay();
ESimManager* esim_manager() { return esim_manager_.get(); }
ESimManagerTestObserver* observer() { return observer_.get(); }
FakeNetworkConnectionHandler* network_connection_handler() {
return network_connection_handler_.get();
}
NetworkStateHandler* network_state_handler() {
return network_state_handler_.get();
}
base::test::TaskEnvironment* task_environment() { return &task_environment_; }
private:
std::unique_ptr<NetworkStateHandler> network_state_handler_;
std::unique_ptr<NetworkDeviceHandler> network_device_handler_;
std::unique_ptr<CellularInhibitor> cellular_inhibitor_;
std::unique_ptr<CellularESimProfileHandler> cellular_esim_profile_handler_;
std::unique_ptr<NetworkConfigurationHandler> network_configuration_handler_;
std::unique_ptr<FakeNetworkConnectionHandler> network_connection_handler_;
std::unique_ptr<CellularESimUninstallHandler>
cellular_esim_uninstall_handler_;
std::unique_ptr<CellularConnectionHandler> cellular_connection_handler_;
base::test::TaskEnvironment task_environment_{
base::test::TaskEnvironment::TimeSource::MOCK_TIME};
std::unique_ptr<ESimManager> esim_manager_;
std::unique_ptr<ESimManagerTestObserver> observer_;
};
} // namespace cellular_setup
} // namespace chromeos
#endif // CHROMEOS_SERVICES_CELLULAR_SETUP_ESIM_TEST_BASE_H_