Skip to content

Commit

Permalink
Create KioskLaunchController unittests
Browse files Browse the repository at this point in the history
kiosk_launch_controller_unittest is a replacement of
kiosk_launch_controller_browsertest adjusted to work as a unit test.

This CL adds a unittest for the timeout of extension install, which
was not previously possible.

Bug: b/256596278
Test: KioskLaunchControllerTest

Change-Id: I6b0add78f85a018f26059b39739fa3522d71c22e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3961411
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Jeroen Dhollander <jeroendh@google.com>
Auto-Submit: Ben Franz <bfranz@chromium.org>
Reviewed-by: Roman Sorokin <rsorokin@google.com>
Commit-Queue: Ben Franz <bfranz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1069033}
  • Loading branch information
bfranz authored and Chromium LUCI CQ committed Nov 9, 2022
1 parent 0668f5d commit 8d96eec
Show file tree
Hide file tree
Showing 8 changed files with 606 additions and 634 deletions.
3 changes: 3 additions & 0 deletions chrome/browser/ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3963,6 +3963,8 @@ static_library("test_support") {
"login/test/embedded_test_server_setup_mixin.h",
"login/test/fake_gaia_mixin.cc",
"login/test/fake_gaia_mixin.h",
"login/test/kiosk_test_helpers.cc",
"login/test/kiosk_test_helpers.h",
"login/test/logged_in_user_mixin.cc",
"login/test/logged_in_user_mixin.h",
"login/test/login_manager_mixin.cc",
Expand Down Expand Up @@ -4549,6 +4551,7 @@ source_set("unit_tests") {
"lock_screen_apps/app_manager_impl_unittest.cc",
"lock_screen_apps/lock_screen_profile_creator_impl_unittest.cc",
"lock_screen_apps/state_controller_unittest.cc",
"login/app_mode/kiosk_launch_controller_unittest.cc",
"login/auth/cryptohome_authenticator_unittest.cc",
"login/consolidated_consent_field_trial_unittest.cc",
"login/demo_mode/demo_components_unittest.cc",
Expand Down
18 changes: 8 additions & 10 deletions chrome/browser/ash/login/app_mode/kiosk_launch_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "ash/public/cpp/login_accelerators.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/check_is_test.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
Expand Down Expand Up @@ -220,17 +221,14 @@ void KioskLaunchController::OnProfileLoaded(Profile* profile) {

const user_manager::User* user =
ProfileHelper::Get()->GetUserByProfile(profile);
if (BrowserDataMigratorImpl::MaybeRestartToMigrate(
user->GetAccountId(), user->username_hash(),
crosapi::browser_util::PolicyInitState::kAfterInit)) {
LOG(WARNING) << "Restarting chrome to run profile migration.";
return;
}

if (BrowserDataBackMigrator::MaybeRestartToMigrateBack(
user->GetAccountId(), user->username_hash(),
crosapi::browser_util::PolicyInitState::kAfterInit)) {
LOG(WARNING) << "Restarting chrome to run backward profile migration.";
// TODO(b/257210467): Remove the need for CHECK_IS_TEST
if (!user) {
CHECK_IS_TEST();
} else if (BrowserDataMigratorImpl::MaybeRestartToMigrate(
user->GetAccountId(), user->username_hash(),
crosapi::browser_util::PolicyInitState::kAfterInit)) {
LOG(WARNING) << "Restarting chrome to run profile migration.";
return;
}

Expand Down

0 comments on commit 8d96eec

Please sign in to comment.