Documentation
¶
Overview ¶
Package kioskmode provides ways to set policies for local device accounts in a Kiosk mode.
Index ¶
- Variables
- func ConfirmKioskStarted(ctx context.Context, reader *syslog.Reader) error
- func IsKioskAppStarted(ctx context.Context) error
- func WaitForCrxInCache(ctx context.Context, id string) error
- type Config
- type Kiosk
- type MutableConfig
- type Option
- func AutoLaunch(accountID string) Option
- func CustomLocalAccounts(accounts *policy.DeviceLocalAccounts) Option
- func DefaultLocalAccounts() Option
- func ExtraChromeOptions(opts ...chrome.Option) Option
- func ExtraPolicies(p []policy.Policy) Option
- func PublicAccountPolicies(accountID string, policies []policy.Policy) Option
Constants ¶
This section is empty.
Variables ¶
var ( // WebKioskAccountID identifier of the web Kiosk application. WebKioskAccountID = "arbitrary_id_web_kiosk_1" // KioskAppAccountID identifier of the Kiosk application. KioskAppAccountID = "arbitrary_id_store_app_2" // KioskAppID pointing to the Printtest app - not listed in the WebStore. KioskAppID = "aajgmlihcokkalfjbangebcffdoanjfo" // KioskAppBtnNode node representing this application on the Apps menu on // the Sign-in screen. KioskAppBtnNode = nodewith.Name("Simple Printest").ClassName("MenuItemView") // DefaultLocalAccountsConfiguration holds default Kiosks accounts // configuration. Each, when setting public account policies can be // referred by id: KioskAppAccountID and WebKioskAccountID DefaultLocalAccountsConfiguration = policy.DeviceLocalAccounts{ Val: []policy.DeviceLocalAccountInfo{ kioskAppPolicy, webKioskPolicy, }, } )
Functions ¶
func ConfirmKioskStarted ¶
ConfirmKioskStarted uses reader for looking for logs that confirm Kiosk mode starting and also successful launch of Kiosk. reader Reader instance should be processing logs filtered for Chrome only.
func IsKioskAppStarted ¶
IsKioskAppStarted searches for existing logs to confirm Kiosk is running.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config contains configurations for Kiosk mode. It holds the necessary policies that will be set to enable Kiosk mode. Once retrieved by NewConfig() it should be used to read from not to modify.
type Kiosk ¶
type Kiosk struct {
// contains filtered or unexported fields
}
Kiosk structure holds necessary references and provides a way to safely close Kiosk mode.
func New ¶
func New(ctx context.Context, fdms *fakedms.FakeDMS, opts ...Option) (*Kiosk, *chrome.Chrome, error)
New starts Chrome, sets passed Kiosk related options to policies and restarts Chrome. When kioskmode.AutoLaunch() is used, then it auto starts given Kiosk application. Alternatively use kioskmode.ExtraChromeOptions() passing chrome.LoadSigninProfileExtension(). In that case Chrome is started and stays on Signin screen with Kiosk accounts loaded. Use defer kiosk.Close(ctx) to clean.
type MutableConfig ¶
type MutableConfig struct { // DeviceLocalAccounts is the configuration with local device accounts. DeviceLocalAccounts *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 Kiosk mode to autolaunch. When true // AutoLaunchKioskAppID id is set to autolaunch. AutoLaunch bool // AutoLaunchKioskAppID is an id of the autolaunched Kiosk account. AutoLaunchKioskAppID *string // ExtraChromeOptions holds all extra options that will be passed to Chrome // instance that will run in Kiosk 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 Kiosk mode. See https://commandcenter.blogspot.com.au/2014/01/self-referential-functions-and-design.html for details about this pattern.
func AutoLaunch ¶
AutoLaunch sets Kiosk app ID to be started after Chrome restart. When used then defer cleaning and refreshing policies policyutil.ServeAndRefresh(ctx, fdms, cr, []policy.Policy{}). Otherwise with next Chrome restart Kiosk will auto start.
func CustomLocalAccounts ¶
func CustomLocalAccounts(accounts *policy.DeviceLocalAccounts) Option
CustomLocalAccounts sets custom local accounts on DUT. Use when the default configuration provided by DefaultLocalAccounts() option is not enough. E.g. when test has to use a specific website or a specific Chrome App.
func DefaultLocalAccounts ¶
func DefaultLocalAccounts() Option
DefaultLocalAccounts uses default Kiosk applications configuration stored in kioskmode.defaultLocalAccountsConfiguration.
func ExtraChromeOptions ¶
ExtraChromeOptions passes Chrome options that will be applied to the Chrome instance running in Kiosk mode.
func ExtraPolicies ¶
ExtraPolicies adds extra policies to be applied with Kiosk app.