blob: ab53c59e2257ac81a79d5ab52b6334073767b159 [file] [log] [blame]
// Copyright 2021 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package peripherals
import (
// guestModeTest contains all the data needed to run a single test iteration.
type guestModeTest struct {
app apps.App
func init() {
Func: LaunchAppFromGuestSession,
Desc: "Peripherals app can be found and launched from guest mode",
Contacts: []string{
Attr: []string{"group:mainline", "informational"},
SoftwareDeps: []string{"chrome"},
Fixture: "chromeLoggedInGuest",
Params: []testing.Param{
Name: "diagnostics",
Val: guestModeTest{
app: apps.Diagnostics,
// LaunchAppFromGuestSession verifies launching an app from guest mode.
func LaunchAppFromGuestSession(ctx context.Context, s *testing.State) {
cr := s.FixtValue().(*chrome.Chrome)
// Attempt to open the Test API connection.
tconn, err := cr.TestAPIConn(ctx)
if err != nil {
s.Fatal("Failed to create Test API Connection: ", err)
defer faillog.DumpUITreeOnError(ctx, s.OutDir(), s.HasError, tconn)
params := s.Param().(guestModeTest)
err = apps.Launch(ctx, tconn,
if err != nil {
s.Fatal("Failed to launch app: ", err)
err = ash.WaitForApp(ctx, tconn,, time.Minute)
if err != nil {
s.Fatal("Could not find app in shelf after launch: ", err)