| // Copyright 2022 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 shimlessrma contains integration tests for Shimless RMA SWA. |
| package shimlessrma |
| |
| import ( |
| "context" |
| "time" |
| |
| "github.com/golang/protobuf/ptypes/empty" |
| "google.golang.org/grpc" |
| |
| "chromiumos/tast/ctxutil" |
| "chromiumos/tast/remote/firmware/fixture" |
| "chromiumos/tast/rpc" |
| pb "chromiumos/tast/services/cros/shimlessrma" |
| "chromiumos/tast/testing" |
| "chromiumos/tast/testing/hwdep" |
| ) |
| |
| func init() { |
| testing.AddTest(&testing.Test{ |
| Func: DisableHWWPWithBatteryDisconnection, |
| LacrosStatus: testing.LacrosVariantUnneeded, |
| Desc: "Can complete Shimless RMA successfully. Disable HWWP with Battery Disconnection", |
| Contacts: []string{ |
| "yanghenry@google.com", |
| "chromeos-engprod-syd@google.com", |
| }, |
| // TODO: Please check http://shortn/_a81SVAkZE7 to find proper attrs. |
| Attr: []string{"group:firmware", "firmware_experimental"}, |
| VarDeps: []string{ |
| "ui.signinProfileTestExtensionManifestKey", |
| }, |
| // Find proper deps from go/tast-deps |
| SoftwareDeps: []string{"chrome"}, |
| HardwareDeps: hwdep.D(hwdep.ChromeEC()), |
| ServiceDeps: []string{"tast.cros.browser.ChromeService", "tast.cros.shimlessrma.AppService"}, |
| Fixture: fixture.DevMode, |
| // TODO: Figure out how to reboot to Normal Mode |
| // Fixture: fixture.NormalMode, |
| Timeout: 5 * time.Minute, |
| }) |
| } |
| |
| func DisableHWWPWithBatteryDisconnection(ctx context.Context, s *testing.State) { |
| cleanupCtx := ctx |
| ctx, cancel := ctxutil.Shorten(ctx, 5*time.Second) |
| defer cancel() |
| |
| h := s.FixtValue().(*fixture.Value).Helper |
| if err := h.RequireServo(ctx); err != nil { |
| s.Fatal("Failed to init servo: ", err) |
| } |
| |
| d := h.DUT |
| |
| if err := d.WaitConnect(ctx); err != nil { |
| s.Fatal("Failed connect to DUT: ", err) |
| } |
| |
| // Setup rpc. |
| cl, err := rpc.Dial(ctx, d, s.RPCHint()) |
| if err != nil { |
| s.Fatal("Failed to connect to the RPC service on the DUT: ", err) |
| } |
| defer cl.Close(cleanupCtx) |
| s.Log("Setup rpc successfully") |
| |
| request := &pb.NewShimlessRMARequest{ |
| ManifestKey: s.RequiredVar("ui.signinProfileTestExtensionManifestKey"), |
| } |
| client := pb.NewAppServiceClient(cl.Conn) |
| if _, err := client.NewShimlessRMA(ctx, request, grpc.WaitForReady(true)); err != nil { |
| s.Fatal("Failed to start Chrome: ", err) |
| } |
| defer client.CloseShimlessRMA(cleanupCtx, &empty.Empty{}) |
| |
| client.TestWelcomeAndCancel(ctx, &empty.Empty{}) |
| } |