blob: 3d65fbf7057d54c6fa68865e57424849ca901094 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2022 The Chromium Authors
Nicolas Dossou-Gbeteade8fdb2022-04-11 15:38:042// 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-Gbete0bea30d12022-04-20 16:41:5018class EnterpriseProfileWelcomeHandler;
19
Nicolas Dossou-Gbeteade8fdb2022-04-11 15:38:0420// This file contains helper functions for testing profile UIs, in particular,
21// the profile picker.
22namespace profiles::testing {
23
24// Wait until the widget of the picker gets created and the initialization of
25// the picker is thus finished (and notably `ProfilePicker::GetViewForTesting()`
26// is not null).
27void WaitForPickerWidgetCreated();
28
29// Waits until the profile picker's current `WebContents` stops loading `url`.
30// This also works if the profile picker's current `WebContents` changes
31// throughout the waiting as it is
32// technically observing all web contents.
33void WaitForPickerLoadStop(const GURL& url);
34
35// Waits until the picker gets closed.
36void WaitForPickerClosed();
37
38// Checks that the profile picker is currently displaying a welcome screen of
Nicolas Dossou-Gbete0bea30d12022-04-20 16:41:5039// type `expected_type` and returns the handler associated with it.
40EnterpriseProfileWelcomeHandler* ExpectPickerWelcomeScreenType(
41 EnterpriseProfileWelcomeUI::ScreenType expected_type);
42
43// Checks that the profile picker is currently displaying a welcome screen of
Nicolas Dossou-Gbeteade8fdb2022-04-11 15:38:0444// type `expected_type` and performs the user action represented by `choice` on
45// that screen.
46void ExpectPickerWelcomeScreenTypeAndProceed(
47 EnterpriseProfileWelcomeUI::ScreenType expected_type,
48 signin::SigninChoice choice);
49
Nicolas Dossou-Gbete5d6213b2022-04-11 17:34:5050#if BUILDFLAG(IS_CHROMEOS_LACROS)
51void CompleteLacrosFirstRun(
52 LoginUIService::SyncConfirmationUIClosedResult result);
53#endif
54
Nicolas Dossou-Gbeteade8fdb2022-04-11 15:38:0455} // namespace profiles::testing
56
57#endif // CHROME_BROWSER_UI_PROFILE_UI_TEST_UTILS_H_