Nicolas Dossou-Gbete | ade8fdb | 2022-04-11 15:38:04 | [diff] [blame] | 1 | // 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-Gbete | 5d6213b | 2022-04-11 17:34:50 | [diff] [blame^] | 14 | #if BUILDFLAG(IS_CHROMEOS_LACROS) |
| 15 | #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 16 | #endif |
| 17 | |
Nicolas Dossou-Gbete | ade8fdb | 2022-04-11 15:38:04 | [diff] [blame] | 18 | // This file contains helper functions for testing profile UIs, in particular, |
| 19 | // the profile picker. |
| 20 | namespace 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). |
| 25 | void 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. |
| 31 | void WaitForPickerLoadStop(const GURL& url); |
| 32 | |
| 33 | // Waits until the picker gets closed. |
| 34 | void 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. |
| 39 | void ExpectPickerWelcomeScreenTypeAndProceed( |
| 40 | EnterpriseProfileWelcomeUI::ScreenType expected_type, |
| 41 | signin::SigninChoice choice); |
| 42 | |
Nicolas Dossou-Gbete | 5d6213b | 2022-04-11 17:34:50 | [diff] [blame^] | 43 | #if BUILDFLAG(IS_CHROMEOS_LACROS) |
| 44 | void CompleteLacrosFirstRun( |
| 45 | LoginUIService::SyncConfirmationUIClosedResult result); |
| 46 | #endif |
| 47 | |
Nicolas Dossou-Gbete | ade8fdb | 2022-04-11 15:38:04 | [diff] [blame] | 48 | } // namespace profiles::testing |
| 49 | |
| 50 | #endif // CHROME_BROWSER_UI_PROFILE_UI_TEST_UTILS_H_ |