Skip to content

Commit

Permalink
[CrOS Cellular] Add physical_slot to HermesManagerClient::TestInterface.
Browse files Browse the repository at this point in the history
Add |physical_slot| param to HermesManagerClient::TestInterface's
AddEuicc() method, and correct all impacted files.

Bug: 1093185
Change-Id: Icdb7cc65a2659a68a9d0ed4f79653e3e8bc09174
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2704816
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Azeem Arshad <azeemarshad@chromium.org>
Commit-Queue: Regan Hsu <hsuregan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#855554}
  • Loading branch information
Regan Hsu authored and Chromium LUCI CQ committed Feb 19, 2021
1 parent 5eca59b commit 9168d01
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 10 deletions.
7 changes: 5 additions & 2 deletions chromeos/dbus/hermes/fake_hermes_manager_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ FakeHermesManagerClient::~FakeHermesManagerClient() = default;

void FakeHermesManagerClient::AddEuicc(const dbus::ObjectPath& path,
const std::string& eid,
bool is_active) {
bool is_active,
uint32_t physical_slot) {
DVLOG(1) << "Adding new euicc path=" << path.value() << ", eid=" << eid
<< ", active=" << is_active;
HermesEuiccClient::Properties* properties =
HermesEuiccClient::Get()->GetProperties(path);
properties->eid().ReplaceValue(eid);
properties->is_active().ReplaceValue(is_active);
properties->physical_slot().ReplaceValue(physical_slot);
available_euiccs_.push_back(path);

base::ThreadTaskRunnerHandle::Get()->PostTask(
Expand Down Expand Up @@ -82,7 +84,8 @@ void FakeHermesManagerClient::ParseCommandLineSwitch() {

// Add a default Euicc and an installed fake carrier profile
// as initial environment.
AddEuicc(dbus::ObjectPath(kDefaultEuiccPath), kDefaultEid, true);
AddEuicc(dbus::ObjectPath(kDefaultEuiccPath), kDefaultEid, /*is_active=*/true,
/*physical_slot=*/0);
HermesEuiccClient::TestInterface* euicc_client_test =
HermesEuiccClient::Get()->GetTestInterface();
euicc_client_test->AddFakeCarrierProfile(dbus::ObjectPath(kDefaultEuiccPath),
Expand Down
3 changes: 2 additions & 1 deletion chromeos/dbus/hermes/fake_hermes_manager_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class COMPONENT_EXPORT(HERMES_CLIENT) FakeHermesManagerClient
// HermesManagerClient::TestInterface:
void AddEuicc(const dbus::ObjectPath& path,
const std::string& eid,
bool is_active) override;
bool is_active,
uint32_t physical_slot) override;
void ClearEuiccs() override;

// HermesManagerClient:
Expand Down
3 changes: 2 additions & 1 deletion chromeos/dbus/hermes/hermes_manager_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class COMPONENT_EXPORT(HERMES_CLIENT) HermesManagerClient {
// Adds a new Euicc object with given path and properties.
virtual void AddEuicc(const dbus::ObjectPath& path,
const std::string& eid,
bool is_actve) = 0;
bool is_actve,
uint32_t physical_slot) = 0;

// Clears all Euicc objects and associated profiles.
virtual void ClearEuiccs() = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class CellularESimConnectionHandlerTest : public testing::Test {
void AddEuicc(int euicc_num) {
helper_.hermes_manager_test()->AddEuicc(
dbus::ObjectPath(CreateTestEuiccPath(euicc_num)),
CreateTestEid(euicc_num), true);
CreateTestEid(euicc_num), /*is_active=*/true, /*physical_slot=*/0);
base::RunLoop().RunUntilIdle();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class CellularESimProfileHandlerImplTest : public testing::Test {
void AddEuicc(int euicc_num) {
helper_.hermes_manager_test()->AddEuicc(
dbus::ObjectPath(CreateTestEuiccPath(euicc_num)),
CreateTestEid(euicc_num), true);
CreateTestEid(euicc_num), /*is_active=*/true, /*physical_slot=*/0);
base::RunLoop().RunUntilIdle();
}

Expand Down
3 changes: 2 additions & 1 deletion chromeos/network/cellular_esim_uninstall_handler_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ class CellularESimUninstallHandlerTest : public testing::Test {
ShillDeviceClient::Get()->GetTestInterface()->AddDevice(
kDefaultCellularDevicePath, shill::kTypeCellular, "cellular1");
HermesManagerClient::Get()->GetTestInterface()->AddEuicc(
dbus::ObjectPath(kDefaultEuiccPath), kDefaultEid, true);
dbus::ObjectPath(kDefaultEuiccPath), kDefaultEid, /*is_active=*/true,
/*physical_slot=*/0);
HermesEuiccClient::Get()->GetTestInterface()->AddCarrierProfile(
dbus::ObjectPath(kTestCarrierProfilePath),
dbus::ObjectPath(kDefaultEuiccPath), kTestCellularIccid,
Expand Down
3 changes: 2 additions & 1 deletion chromeos/network/network_connection_handler_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ class NetworkConnectionHandlerImplTest : public testing::Test {

// Add EUICC which will hold the profile.
helper_.hermes_manager_test()->AddEuicc(dbus::ObjectPath(kTestEuiccPath),
kTestEid, true);
kTestEid, /*is_active=*/true,
/*physical_slot=*/0);

// Add eSIM profile; internally, this causes an associated Shill service to
// be created.
Expand Down
3 changes: 2 additions & 1 deletion chromeos/services/cellular_setup/esim_test_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ void ESimTestBase::TearDown() {

void ESimTestBase::SetupEuicc() {
HermesManagerClient::Get()->GetTestInterface()->AddEuicc(
dbus::ObjectPath(kTestEuiccPath), kTestEid, true);
dbus::ObjectPath(kTestEuiccPath), kTestEid, /*is_active=*/true,
/*physical_slot=*/0);
base::RunLoop().RunUntilIdle();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,8 @@ TEST_F(CrosNetworkConfigTest, ESimNetworkNameComesFromHermes) {

// Add a fake eSIM with name kTestProfileName.
helper().hermes_manager_test()->AddEuicc(dbus::ObjectPath(kTestEuiccPath),
"eid", true);
"eid", /*is_active=*/true,
/*physical_slot=*/0);
helper().hermes_euicc_test()->AddCarrierProfile(
dbus::ObjectPath(kTestProfileServicePath),
dbus::ObjectPath(kTestEuiccPath), kTestIccid, kTestProfileName,
Expand Down

0 comments on commit 9168d01

Please sign in to comment.