Commit 76ad58f2 authored by Lucas Tenório's avatar Lucas Tenório Committed by Commit Bot

Add pref for Kiosk Next eligibility.

One of the paths that determines eligibility is during onboarding.

Bug: 958995
Change-Id: I58056f8edea1b9da2f9ddd4b0ff0ae9ef6d1bcf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1621397
Commit-Queue: Lucas Tenório <ltenorio@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662211}
parent 26384deb
...@@ -88,6 +88,10 @@ const char kAccessibilityDictationEnabled[] = "settings.a11y.dictation"; ...@@ -88,6 +88,10 @@ const char kAccessibilityDictationEnabled[] = "settings.a11y.dictation";
// regardless of the state of a11y features. // regardless of the state of a11y features.
const char kShouldAlwaysShowAccessibilityMenu[] = "settings.a11y.enable_menu"; const char kShouldAlwaysShowAccessibilityMenu[] = "settings.a11y.enable_menu";
// A boolean pref that stores whether the user is eligible to start the Kiosk
// Next shell.
const char kKioskNextShellEligible[] = "ash.kiosk_next_shell.eligible";
// A boolean pref that stores whether the Kiosk Next Shell is enabled. When it // A boolean pref that stores whether the Kiosk Next Shell is enabled. When it
// is, we start it after sign in. // is, we start it after sign in.
const char kKioskNextShellEnabled[] = "ash.kiosk_next_shell.enabled"; const char kKioskNextShellEnabled[] = "ash.kiosk_next_shell.enabled";
......
...@@ -36,6 +36,7 @@ ASH_PUBLIC_EXPORT extern const char kAccessibilitySwitchAccessEnabled[]; ...@@ -36,6 +36,7 @@ ASH_PUBLIC_EXPORT extern const char kAccessibilitySwitchAccessEnabled[];
ASH_PUBLIC_EXPORT extern const char kAccessibilityDictationEnabled[]; ASH_PUBLIC_EXPORT extern const char kAccessibilityDictationEnabled[];
ASH_PUBLIC_EXPORT extern const char kShouldAlwaysShowAccessibilityMenu[]; ASH_PUBLIC_EXPORT extern const char kShouldAlwaysShowAccessibilityMenu[];
ASH_PUBLIC_EXPORT extern const char kKioskNextShellEligible[];
ASH_PUBLIC_EXPORT extern const char kKioskNextShellEnabled[]; ASH_PUBLIC_EXPORT extern const char kKioskNextShellEnabled[];
ASH_PUBLIC_EXPORT extern const char kDockedMagnifierEnabled[]; ASH_PUBLIC_EXPORT extern const char kDockedMagnifierEnabled[];
......
...@@ -200,9 +200,11 @@ void Preferences::RegisterProfilePrefs( ...@@ -200,9 +200,11 @@ void Preferences::RegisterProfilePrefs(
hardware_keyboard_id = "xkb:us::eng"; // only for testing. hardware_keyboard_id = "xkb:us::eng"; // only for testing.
} }
registry->RegisterBooleanPref(ash::prefs::kKioskNextShellEligible,
/*default_value=*/false);
registry->RegisterBooleanPref(ash::prefs::kKioskNextShellEnabled, registry->RegisterBooleanPref(ash::prefs::kKioskNextShellEnabled,
false /* default_value */, /*default_value=*/false, PrefRegistry::PUBLIC);
PrefRegistry::PUBLIC);
registry->RegisterBooleanPref(prefs::kPerformanceTracingEnabled, false); registry->RegisterBooleanPref(prefs::kPerformanceTracingEnabled, false);
......
...@@ -110,7 +110,10 @@ void OnboardingControllerImpl::LoadPageCallback( ...@@ -110,7 +110,10 @@ void OnboardingControllerImpl::LoadPageCallback(
!base::EqualsCaseInsensitiveASCII(custom_header_value.value(), !base::EqualsCaseInsensitiveASCII(custom_header_value.value(),
kDeviceOnboardingExperimentName)) { kDeviceOnboardingExperimentName)) {
webview_host_->ExitFlow(); webview_host_->ExitFlow();
return;
} }
profile_->GetPrefs()->SetBoolean(ash::prefs::kKioskNextShellEligible, true);
} }
} // namespace supervision } // namespace supervision
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <memory> #include <memory>
#include "ash/public/cpp/ash_pref_names.h"
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/chromeos/supervision/mojom/onboarding_controller.mojom.h" #include "chrome/browser/chromeos/supervision/mojom/onboarding_controller.mojom.h"
#include "chrome/browser/chromeos/supervision/onboarding_constants.h" #include "chrome/browser/chromeos/supervision/onboarding_constants.h"
...@@ -197,5 +198,27 @@ TEST_F(OnboardingControllerTest, ExitFlowWhenHeaderValueIsWrong) { ...@@ -197,5 +198,27 @@ TEST_F(OnboardingControllerTest, ExitFlowWhenHeaderValueIsWrong) {
EXPECT_TRUE(webview_host()->exited_flow()); EXPECT_TRUE(webview_host()->exited_flow());
} }
TEST_F(OnboardingControllerTest,
SetEligibleForKioskNextWhenHeaderValueIsCorrect) {
BindWebviewHost();
webview_host()->set_custom_header_value(kDeviceOnboardingExperimentName);
WaitForAuthRequestAndReturnToken("fake_access_token");
EXPECT_TRUE(
profile()->GetPrefs()->GetBoolean(ash::prefs::kKioskNextShellEligible));
}
TEST_F(OnboardingControllerTest,
SetNotEligibleForKioskNextWhenHeaderValueIsWrong) {
BindWebviewHost();
webview_host()->set_custom_header_value("clearly-wrong-header-value");
WaitForAuthRequestAndReturnToken("fake_access_token");
EXPECT_FALSE(
profile()->GetPrefs()->GetBoolean(ash::prefs::kKioskNextShellEligible));
}
} // namespace supervision } // namespace supervision
} // namespace chromeos } // namespace chromeos
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment