Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2022 The Chromium Authors |
Nicolas Dossou-Gbete | ade8fdb | 2022-04-11 15:38:04 | [diff] [blame] | 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 | 0bea30d1 | 2022-04-20 16:41:50 | [diff] [blame] | 18 | class EnterpriseProfileWelcomeHandler; |
| 19 | |
Nicolas Dossou-Gbete | ade8fdb | 2022-04-11 15:38:04 | [diff] [blame] | 20 | // This file contains helper functions for testing profile UIs, in particular, |
| 21 | // the profile picker. |
| 22 | namespace 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). |
| 27 | void 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. |
| 33 | void WaitForPickerLoadStop(const GURL& url); |
| 34 | |
| 35 | // Waits until the picker gets closed. |
| 36 | void WaitForPickerClosed(); |
| 37 | |
| 38 | // Checks that the profile picker is currently displaying a welcome screen of |
Nicolas Dossou-Gbete | 0bea30d1 | 2022-04-20 16:41:50 | [diff] [blame] | 39 | // type `expected_type` and returns the handler associated with it. |
| 40 | EnterpriseProfileWelcomeHandler* ExpectPickerWelcomeScreenType( |
| 41 | EnterpriseProfileWelcomeUI::ScreenType expected_type); |
| 42 | |
| 43 | // Checks that the profile picker is currently displaying a welcome screen of |
Nicolas Dossou-Gbete | ade8fdb | 2022-04-11 15:38:04 | [diff] [blame] | 44 | // type `expected_type` and performs the user action represented by `choice` on |
| 45 | // that screen. |
| 46 | void ExpectPickerWelcomeScreenTypeAndProceed( |
| 47 | EnterpriseProfileWelcomeUI::ScreenType expected_type, |
| 48 | signin::SigninChoice choice); |
| 49 | |
Nicolas Dossou-Gbete | 5d6213b | 2022-04-11 17:34:50 | [diff] [blame] | 50 | #if BUILDFLAG(IS_CHROMEOS_LACROS) |
| 51 | void CompleteLacrosFirstRun( |
| 52 | LoginUIService::SyncConfirmationUIClosedResult result); |
| 53 | #endif |
| 54 | |
Nicolas Dossou-Gbete | ade8fdb | 2022-04-11 15:38:04 | [diff] [blame] | 55 | } // namespace profiles::testing |
| 56 | |
| 57 | #endif // CHROME_BROWSER_UI_PROFILE_UI_TEST_UTILS_H_ |