chromium/third_party/blink/public/mojom/webid/federated_auth_request_automation.mojom

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module blink.test.mojom;

enum DialogButton {
  kConfirmIdpLoginContinue,
  kErrorGotIt,
  kErrorMoreDetails,
};

// Provides a way for tests without chromedriver support to execute certain FedCM commands.
// See https://fedidcg.github.io/FedCM/#automation.
interface FederatedAuthRequestAutomation {
  // Gets the dialog type of the current FedCM dialog, if one is open.
  GetDialogType() => (string? title);

  // Returns the title of the current FedCM dialog, if any is open at the time it is invoked.
  GetFedCmDialogTitle() => (string? title);

  // Selects the account with the given account_index, if there is any FedCM account chooser open.
  SelectFedCmAccount(uint32 account_index) => (bool success);

  // Dismisses the current dialog, if one is open.
  DismissFedCmDialog() => (bool success);

  // Clicks on a button in the current dialog, if one is open.
  ClickFedCmDialogButton(DialogButton dialog_button) => (bool success);
};