Documentation ¶
Overview ¶
Package mgs provides ways to set policies for local device accounts in MGS mode.
Index ¶
Constants ¶
const ( // LoginScreenExtensionID is the ID for "Login screen APIs test extension". LoginScreenExtensionID = "oclffehlkdgibkainkilopaalpdobkan" // InSessionExtensionID is the ID for "Login screen APIs in-session test extension". InSessionExtensionID = "ofcpkomnogjenhfajfjadjmjppbegnad" )
Variables ¶
var ( // MgsAccountID is the default MGS ID. MgsAccountID = "defaultMgsSetByTast" // AccountType is the default public session account type. AccountType = policy.AccountTypePublicSession )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config contains configurations for MGS mode. It holds the necessary policies that will be set to enable MGS mode. Once retrieved by NewConfig() it should be used to read from not to modify.
type FixtData ¶
type FixtData struct {
// contains filtered or unexported fields
}
FixtData holds chrome instance and session login time.
type MGS ¶
type MGS struct {
// contains filtered or unexported fields
}
MGS holds chrome and fakedms instances.
func New ¶
New starts Chrome, sets passed MGS related options to policies and restarts Chrome. Use mgs.AutoLaunch()to auto start MGS for a given account ID. Alternatively use mgs.ExtraChromeOptions() passing chrome.LoadSigninProfileExtension(). In that case Chrome is started and stays on Signin screen with mgs accounts loaded. Use defer mgs.Close() to perform clean up including closing Chrome instance.
type MutableConfig ¶
type MutableConfig struct { // MGSAccounts applies DeviceLocalAccountInfo custom DeviceLocalAccountInfo configuration. MGSAccounts *policy.DeviceLocalAccounts // ExtraPolicies holds extra policies that will be applied. ExtraPolicies []policy.Policy // PublicAccountPolicies holds public accounts' IDs with associated polices // that will be applied to the them. PublicAccountPolicies map[string][]policy.Policy // AutoLaunch determines whether to set MGS mode to autolaunch. When true // AutoLaunchMGSAppID id is set to autolaunch. AutoLaunch bool // AutoLaunchMGSAppID is an id of the autolaunched MGS account. AutoLaunchMGSAppID *string // ExtraChromeOptions holds all extra options that will be passed to Chrome // instance that will run in MGS mode. ExtraChromeOptions []chrome.Option }
MutableConfig holds pieces of configuration that are set with Options.
type Option ¶
type Option func(cfg *MutableConfig) error
Option is a self-referential function can be used to configure MGS mode. See https://commandcenter.blogspot.com.au/2014/01/self-referential-functions-and-design.html for details about this pattern.
func Accounts ¶
Accounts creates DeviceLocalAccountInfo (of a type policy.AccountTypePublicSession) for each passed accountID and adds them all to policy.DeviceLocalAccounts.
func AddPublicAccountPolicies ¶
AddPublicAccountPolicies adds policies that will be applied to the account.
func AutoLaunch ¶
AutoLaunch sets MGS ID to be started after Chrome restart.
func DefaultAccount ¶
func DefaultAccount() Option
DefaultAccount applies default local account configuration using one arbitrary MGS definition in the mgs package. MGS account id is exposed from the package.
func ExtraChromeOptions ¶
ExtraChromeOptions passes Chrome options that will be applied to the Chrome instance running in MGS mode.
func ExtraPolicies ¶
ExtraPolicies adds policies to be applied with MGS.