blob: 9746b4aaa30f81ce15e5640bce06ecd151e49ee5 [file] [log] [blame]
Nicolas Dossou-Gbeteade8fdb2022-04-11 15:38:041// Copyright 2022 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_PROFILE_UI_TEST_UTILS_H_
6#define CHROME_BROWSER_UI_PROFILE_UI_TEST_UTILS_H_
7
8#include "base/files/file_path.h"
9#include "build/build_config.h"
10#include "build/chromeos_buildflags.h"
11#include "chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.h"
12#include "url/gurl.h"
13
Nicolas Dossou-Gbete5d6213b2022-04-11 17:34:5014#if BUILDFLAG(IS_CHROMEOS_LACROS)
15#include "chrome/browser/ui/webui/signin/login_ui_service.h"
16#endif
17
Nicolas Dossou-Gbeteade8fdb2022-04-11 15:38:0418// This file contains helper functions for testing profile UIs, in particular,
19// the profile picker.
20namespace profiles::testing {
21
22// Wait until the widget of the picker gets created and the initialization of
23// the picker is thus finished (and notably `ProfilePicker::GetViewForTesting()`
24// is not null).
25void WaitForPickerWidgetCreated();
26
27// Waits until the profile picker's current `WebContents` stops loading `url`.
28// This also works if the profile picker's current `WebContents` changes
29// throughout the waiting as it is
30// technically observing all web contents.
31void WaitForPickerLoadStop(const GURL& url);
32
33// Waits until the picker gets closed.
34void WaitForPickerClosed();
35
36// Checks that the profile picker is currently displaying a welcome screen of
37// type `expected_type` and performs the user action represented by `choice` on
38// that screen.
39void ExpectPickerWelcomeScreenTypeAndProceed(
40 EnterpriseProfileWelcomeUI::ScreenType expected_type,
41 signin::SigninChoice choice);
42
Nicolas Dossou-Gbete5d6213b2022-04-11 17:34:5043#if BUILDFLAG(IS_CHROMEOS_LACROS)
44void CompleteLacrosFirstRun(
45 LoginUIService::SyncConfirmationUIClosedResult result);
46#endif
47
Nicolas Dossou-Gbeteade8fdb2022-04-11 15:38:0448} // namespace profiles::testing
49
50#endif // CHROME_BROWSER_UI_PROFILE_UI_TEST_UTILS_H_