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
|
// 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 CHROME_TEST_BASE_ASH_INTERACTIVE_CELLULAR_CELLULAR_UTIL_H_
#define CHROME_TEST_BASE_ASH_INTERACTIVE_CELLULAR_CELLULAR_UTIL_H_
#include <optional>
#include <string>
#include "base/values.h"
#include "chromeos/ash/components/network/network_state_handler.h"
#include "chromeos/ash/components/network/network_state_handler_observer.h"
#include "ui/base/interaction/state_observer.h"
namespace ash {
// Helper class to simplify the definition of eUICC constants.
class EuiccInfo {
public:
// The `id` parameter is used when generating values for each of the
// different eUICC properties below.
explicit EuiccInfo(unsigned int id);
~EuiccInfo();
const std::string& path() const { return path_; }
const std::string& eid() const { return eid_; }
private:
const std::string path_;
const std::string eid_;
};
// Helper class to simplify the definition of SIM profile constants.
class SimInfo {
public:
// The `id` parameter is used when generating values for each of the different
// SIM properties below.
explicit SimInfo(unsigned int id);
~SimInfo();
// Connects to the cellular network corresponding to the eSIM profile matching
// the properties of this class.
void Connect() const;
// Disconnects from the cellular network corresponding to the eSIM profile
// matching the properties of this class.
void Disconnect() const;
const std::string& guid() const { return guid_; }
const std::string& profile_path() const { return profile_path_; }
const std::string& iccid() const { return iccid_; }
const std::string& name() const { return name_; }
const std::string& nickname() const { return nickname_; }
const std::string& service_provider() const { return service_provider_; }
const std::string& service_path() const { return service_path_; }
const std::string& activation_code() const { return activation_code_; }
private:
const std::string guid_;
const std::string profile_path_;
const std::string iccid_;
const std::string name_;
const std::string nickname_;
const std::string service_provider_;
const std::string service_path_;
std::string activation_code_;
};
// Helper function to configure an eSIM profile and corresponding Shill service.
void ConfigureEsimProfile(const EuiccInfo& euicc_info,
const SimInfo& esim_info,
bool connected);
// Helper function to build a policy dictionary for a particualar cellular
// network. This function implements logic that is normally handled when the
// policy is ingested by ChromeOS but before it is applied; for example,
// automatically marking the `CustomAPNList` property as recommended.
base::Value::Dict GenerateCellularPolicy(const SimInfo& info,
bool allow_apn_modification = true,
bool allow_roaming = true);
} // namespace ash
#endif // CHROME_TEST_BASE_ASH_INTERACTIVE_CELLULAR_CELLULAR_UTIL_H_
|