0

[reland] cros: Remove forest secret key

Since forest flag is flipped on because of testing variations, removing
the key exposes a couple tests that now fail. I skipped them all, there
are 8 total. The two I am familiar with I will be removing once the
feature is fully launched, the rest I left TODOs.

Original CL is patchset 1.

Had a pre-flight CL CL:5647082 that original made the post-login
onboarding modal dialog which was interfering some browser tests not
show up by default, but missed one case in ash/ that occasionally
interferes on slower builds.

Test: existing tests
Bug: b:328779923
Change-Id: I6b0c76f14df3f5434645a1f99bbc30630f36b532
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5653578
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1319443}
This commit is contained in:
Sammie Quon
2024-06-25 22:02:33 +00:00
committed by Chromium LUCI CQ
parent abd4eb63a0
commit deee713ebc
50 changed files with 153 additions and 314 deletions

@ -2609,8 +2609,6 @@ component("ash") {
"utility/cropping_util.h",
"utility/cursor_setter.cc",
"utility/cursor_setter.h",
"utility/forest_util.cc",
"utility/forest_util.h",
"utility/layer_copy_animator.cc",
"utility/layer_copy_animator.h",
"utility/layer_util.cc",
@ -3155,9 +3153,6 @@ component("ash") {
"//chromeos/ui/vector_icons",
"//components/discardable_memory/public/mojom",
"//components/version_info:channel",
# TODO(http://b/333952534): Remove this once we no longer need gaia API.
"//google_apis",
"//google_apis/calendar",
"//google_apis/common",
"//google_apis/tasks",

@ -3681,6 +3681,10 @@ bool IsForceReSyncDriveEnabled() {
return base::FeatureList::IsEnabled(kForceReSyncDrive);
}
bool IsForestFeatureEnabled() {
return base::FeatureList::IsEnabled(kForestFeature);
}
bool IsFullscreenAfterUnlockAllowed() {
return base::FeatureList::IsEnabled(kFullscreenAfterUnlockAllowed);
}

@ -1121,6 +1121,7 @@ COMPONENT_EXPORT(ASH_CONSTANTS) bool IsFocusModeEnabled();
COMPONENT_EXPORT(ASH_CONSTANTS)
bool ShouldForceEnableServerSideSpeechRecognitionForDev();
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsForceReSyncDriveEnabled();
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsForestFeatureEnabled();
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsEcheLauncherEnabled();
COMPONENT_EXPORT(ASH_CONSTANTS) bool IsEcheLauncherListViewEnabled();
COMPONENT_EXPORT(ASH_CONSTANTS)

@ -23,14 +23,6 @@ namespace {
constexpr base::TimeDelta kAshContextualNudgesMinInterval = base::Seconds(0);
constexpr base::TimeDelta kAshContextualNudgesMaxInterval = base::Seconds(60);
// The hash value for the secret key of the forest feature.
constexpr char kForestHashKey[] =
"\x1a\x93\x5f\x64\x0d\x7f\x0c\x2f\x88\xe8\x80\x9a\x5f\x16\xbb\xd8\x74\x06"
"\x8a\xb1";
// Whether checking the forest secret key is ignored.
bool g_ignore_forest_secret_key = false;
// The hash value for the secret key of the campbell feature.
constexpr char kCampbellHashKey[] =
"\x78\xb6\xa7\x59\x06\x11\xc7\xea\x09\x7e\x92\xe3\xe9\xff\xa6\x01\x4c"
@ -1400,30 +1392,6 @@ bool IsConchSecretKeyMatched() {
return key_matched;
}
bool IsForestSecretKeyMatched() {
if (g_ignore_forest_secret_key) {
return true;
}
// Commandline looks like:
// out/Default/chrome --user-data-dir=/tmp/tmp123
// --forest-feature-key="INSERT KEY HERE" --enable-features=ForestFeature
const std::string provided_key_hash = base::SHA1HashString(
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
kForestFeatureKey));
bool forest_key_matched = (provided_key_hash == kForestHashKey);
if (!forest_key_matched) {
LOG(ERROR) << "Provided secret key does not match with the expected one.";
}
return forest_key_matched;
}
void SetIgnoreForestSecretKeyForTest(bool ignore) {
g_ignore_forest_secret_key = ignore;
}
bool IsMahiSecretKeyMatched() {
if (g_ignore_mahi_secret_key) {
return true;

@ -506,12 +506,6 @@ bool IsCampbellSecretKeyMatched();
COMPONENT_EXPORT(ASH_CONSTANTS)
bool IsConchSecretKeyMatched();
COMPONENT_EXPORT(ASH_CONSTANTS)
bool IsForestSecretKeyMatched();
COMPONENT_EXPORT(ASH_CONSTANTS)
void SetIgnoreForestSecretKeyForTest(bool ignore);
COMPONENT_EXPORT(ASH_CONSTANTS)
bool IsMahiSecretKeyMatched();

@ -49,7 +49,6 @@
#include "ash/touch/touch_hud_debug.h"
#include "ash/touch/touch_hud_projection.h"
#include "ash/touch/touch_observer_hud.h"
#include "ash/utility/forest_util.h"
#include "ash/wallpaper/views/wallpaper_widget_controller.h"
#include "ash/wm/always_on_top_controller.h"
#include "ash/wm/container_finder.h"
@ -841,7 +840,7 @@ void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen,
ui::MenuSourceType source_type) {
// Show birch bar context menu for the primary user in clamshell mode Overview
// without a partial split screen.
if (IsForestFeatureEnabled() &&
if (features::IsForestFeatureEnabled() &&
Shell::Get()->session_controller()->IsUserPrimary() &&
OverviewController::Get()->InOverviewSession() &&
!split_view_overview_session_) {
@ -1209,7 +1208,7 @@ void RootWindowController::CreateContainers() {
non_lock_screen_containers);
aura::Window* shutdown_screenshot_container = non_lock_screen_containers;
if (IsForestFeatureFlagEnabled()) {
if (features::IsForestFeatureEnabled()) {
shutdown_screenshot_container = CreateContainer(
kShellWindowId_ShutdownScreenshotContainer,
"ShutdownScreenshotContainer", non_lock_screen_containers);

@ -22,7 +22,6 @@
#include "ash/shell.h"
#include "ash/style/system_shadow.h"
#include "ash/system/status_area_widget.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/overview/overview_observer.h"
#include "base/i18n/rtl.h"
@ -521,7 +520,8 @@ void HotseatWidget::DelegateView::Init(
OverviewController* overview_controller = Shell::Get()->overview_controller();
if (overview_controller) {
overview_controller->AddObserver(this);
if (overview_controller->InOverviewSession() && !IsForestFeatureEnabled()) {
if (overview_controller->InOverviewSession() &&
!features::IsForestFeatureEnabled()) {
++blur_lock_;
}
}
@ -609,7 +609,7 @@ SkColor HotseatWidget::DelegateView::GetBackgroundColor() {
CHECK(widget);
aura::Window* window = widget->GetNativeWindow();
// A forest session uses system-on-base.
if (IsForestFeatureEnabled() &&
if (features::IsForestFeatureEnabled() &&
OverviewController::Get()->InOverviewSession() &&
!SplitViewController::Get(window)->InSplitViewMode()) {
return widget->GetColorProvider()->GetColor(
@ -722,7 +722,7 @@ bool HotseatWidget::DelegateView::CanActivate() const {
void HotseatWidget::DelegateView::OnOverviewModeWillStart() {
// Forest uses background blur in overview.
was_forest_on_overview_enter_ = IsForestFeatureEnabled();
was_forest_on_overview_enter_ = features::IsForestFeatureEnabled();
if (*was_forest_on_overview_enter_) {
return;
}

@ -40,7 +40,6 @@
#include "ash/system/unified/unified_system_tray.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/layer_animation_verifier.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h"
#include "ash/wm/window_state.h"
@ -991,7 +990,7 @@ TEST_P(HotseatWidgetTest, ObserverCallsMatch) {
TEST_P(HotseatWidgetTest, DisableBlurDuringOverviewMode) {
// TODO(sammiequon): Remove this test when forest feature can no longer be
// disabled.
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
return;
}

@ -34,7 +34,6 @@
#include "ash/style/ash_color_id.h"
#include "ash/style/style_util.h"
#include "ash/system/status_area_widget.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/work_area_insets.h"
@ -493,7 +492,7 @@ void ShelfWidget::DelegateView::UpdateOpaqueBackground() {
const bool in_overview_mode = ShelfConfig::Get()->in_overview_mode();
const bool in_oak_session =
in_overview_mode &&
(features::IsOakFeatureEnabled() || IsForestFeatureEnabled());
(features::IsOakFeatureEnabled() || features::IsForestFeatureEnabled());
const bool split_view = ShelfConfig::Get()->in_split_view_with_overview();
bool show_opaque_background =
(!in_oak_session) && (!tablet_mode || in_app || split_view);

@ -201,7 +201,6 @@
#include "ash/tray_action/tray_action.h"
#include "ash/user_education/user_education_controller.h"
#include "ash/user_education/user_education_delegate.h"
#include "ash/utility/forest_util.h"
#include "ash/utility/occlusion_tracker_pauser.h"
#include "ash/wallpaper/wallpaper_controller_impl.h"
#include "ash/wm/ash_focus_rules.h"
@ -1606,7 +1605,7 @@ void Shell::Init(
// used in its constructor.
app_list_controller_ = std::make_unique<AppListControllerImpl>();
if (IsForestFeatureFlagEnabled()) {
if (features::IsForestFeatureEnabled()) {
birch_model_ = std::make_unique<BirchModel>();
}
@ -1780,7 +1779,7 @@ void Shell::Init(
projector_controller_ = std::make_unique<ProjectorControllerImpl>();
float_controller_ = std::make_unique<FloatController>();
if (IsForestFeatureFlagEnabled()) {
if (features::IsForestFeatureEnabled()) {
pine_controller_ = std::make_unique<PineController>();
}
pip_controller_ = std::make_unique<PipController>();

@ -44,4 +44,8 @@ DeskProfilesDelegate* ShellDelegate::GetDeskProfilesDelegate() {
return nullptr;
}
bool ShellDelegate::IsNoFirstRunSwitchOn() const {
return false;
}
} // namespace ash

@ -225,6 +225,10 @@ class ASH_EXPORT ShellDelegate {
// Opens the Multitasking OS Settings page.
virtual void OpenMultitaskingSettings() = 0;
// Checks if the command line contains "no-first-run". Some UI's can interfere
// with browser tests, which have "no-first-run" on by default.
virtual bool IsNoFirstRunSwitchOn() const;
};
} // namespace ash

@ -147,9 +147,6 @@ void AshTestBase::SetUp(std::unique_ptr<TestShellDelegate> delegate) {
setup_called_ = true;
// TODO(http://b/338414459): Remove this once the secret key is removed.
switches::SetIgnoreForestSecretKeyForTest(true);
AshTestHelper::InitParams params;
params.start_session = start_session_;
params.create_global_cras_audio_handler = create_global_cras_audio_handler_;
@ -205,9 +202,6 @@ void AshTestBase::TearDown() {
// Tests can add devices, so reset the lists for future tests.
ui::DeviceDataManager::GetInstance()->ResetDeviceListsForTest();
// TODO(http://b/338414459): Remove this once the secret key is removed.
switches::SetIgnoreForestSecretKeyForTest(false);
}
// static

@ -1,3 +0,0 @@
include_rules = [
"+google_apis",
]

@ -1,51 +0,0 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/utility/forest_util.h"
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_switches.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "google_apis/gaia/gaia_auth_util.h"
namespace ash {
namespace {
// Caches the result of `switches::IsForestSecretKeyMatched()` which not only
// has to fetch and compare strings, but will log an error everytime if they do
// not match.
std::optional<bool> g_cache_secret_key_matched;
}
bool IsForestFeatureFlagEnabled() {
return base::FeatureList::IsEnabled(features::kForestFeature);
}
bool IsForestFeatureEnabled() {
if (!IsForestFeatureFlagEnabled()) {
return false;
}
// The shell may not be created in some unit tests.
Shell* shell = Shell::HasInstance() ? Shell::Get() : nullptr;
// TODO(http://b/333952534): Remove the google api DEPS changes, and move this
// function back to ash/constants/ash_features.
if (shell &&
gaia::IsGoogleInternalAccountEmail(
shell->session_controller()->GetActiveAccountId().GetUserEmail())) {
return true;
}
if (!g_cache_secret_key_matched) {
g_cache_secret_key_matched = switches::IsForestSecretKeyMatched();
}
return *g_cache_secret_key_matched;
}
} // namespace ash

@ -1,20 +0,0 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_UTILITY_FOREST_UTIL_H_
#define ASH_UTILITY_FOREST_UTIL_H_
#include "ash/ash_export.h"
namespace ash {
ASH_EXPORT bool IsForestFeatureFlagEnabled();
// Checks for the forest feature. This needs a secret key, unless the active
// user is a google account.
ASH_EXPORT bool IsForestFeatureEnabled();
} // namespace ash
#endif // ASH_UTILITY_FOREST_UTIL_H_

@ -4,11 +4,11 @@
#include "ash/wallpaper/views/wallpaper_widget_controller.h"
#include "ash/constants/ash_features.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/style/color_util.h"
#include "ash/utility/forest_util.h"
#include "ash/wallpaper/views/wallpaper_view.h"
#include "ui/aura/window.h"
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
@ -140,7 +140,7 @@ void WallpaperWidgetController::OnColorProviderChanged() {
}
void WallpaperWidgetController::CreateWallpaperUnderlayLayer() {
if (!features::IsOakFeatureEnabled() && !IsForestFeatureFlagEnabled()) {
if (!features::IsOakFeatureEnabled() && !features::IsForestFeatureEnabled()) {
return;
}

@ -34,7 +34,6 @@
#include "ash/system/time/calendar_unittest_utils.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/ash_test_util.h"
#include "ash/utility/forest_util.h"
#include "ash/wallpaper/sea_pen_wallpaper_manager.h"
#include "ash/wallpaper/test_sea_pen_wallpaper_manager_session_delegate.h"
#include "ash/wallpaper/test_wallpaper_controller_client.h"
@ -1160,7 +1159,7 @@ TEST_P(WallpaperControllerTest, WallpaperMovementDuringUnlock) {
// that will animate in on top of the old one.
controller->CreateEmptyWallpaperForTesting();
const bool forest_enabled = IsForestFeatureEnabled();
const bool forest_enabled = features::IsForestFeatureEnabled();
// In this state we have a wallpaper views stored in
// LockScreenWallpaperContainer.
@ -3420,7 +3419,7 @@ TEST_P(WallpaperControllerTest, WallpaperBlurDuringLockScreenTransition) {
controller_->GetWallpaperType()));
ASSERT_FALSE(controller_->IsWallpaperBlurredForLockState());
const bool forest_enabled = IsForestFeatureEnabled();
const bool forest_enabled = features::IsForestFeatureEnabled();
if (forest_enabled) {
// There are three layers: underlay, original and old layers.
ASSERT_EQ(3u, wallpaper_view()->layer()->parent()->children().size());

@ -21,7 +21,6 @@
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_id.h"
#include "ash/style/typography.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/desks/desk.h"
#include "ash/wm/desks/desk_action_button.h"
#include "ash/wm/desks/desk_action_view.h"
@ -128,7 +127,7 @@ void MaybeSetupBackgroundView(DeskBarViewBase* bar_view) {
auto* layer = view->layer();
layer->SetFillsBoundsOpaquely(false);
if ((features::IsOakFeatureEnabled() || IsForestFeatureEnabled()) &&
if ((features::IsOakFeatureEnabled() || features::IsForestFeatureEnabled()) &&
!type_is_desk_button) {
// Oak feature needs a transparent desks bar background. Still needs the
// view layer to perform animations.
@ -647,7 +646,8 @@ int DeskBarViewBase::GetPreferredBarHeight(aura::Window* root,
height = kDeskBarZeroStateHeight;
} else {
height = DeskPreviewView::GetHeight(root) +
(features::IsOakFeatureEnabled() || IsForestFeatureEnabled()
(features::IsOakFeatureEnabled() ||
features::IsForestFeatureEnabled()
? kExpandedDeskBarHeightWithOak
: kDeskBarNonPreviewAllocatedHeight);
}

@ -18,7 +18,6 @@
#include "ash/style/ash_color_id.h"
#include "ash/style/close_button.h"
#include "ash/style/style_util.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/desks/desk_action_button.h"
#include "ash/wm/desks/desk_action_context_menu.h"
#include "ash/wm/desks/desk_action_view.h"
@ -447,7 +446,7 @@ void DeskMiniView::OpenContextMenu(ui::MenuSourceType source) {
// button.
// Don't show save options if there are no windows in the desk, or if the
// desk bar did not originate from overview.
if (IsForestFeatureEnabled() && desk_->is_active() &&
if (features::IsForestFeatureEnabled() && desk_->is_active() &&
ContainsAppWindows(desk_) &&
owner_bar_->type() == DeskBarViewBase::Type::kOverview) {
if (saved_desk_util::AreDesksTemplatesEnabled()) {

@ -48,7 +48,6 @@
#include "ash/test/ash_test_helper.h"
#include "ash/test/ash_test_util.h"
#include "ash/test/test_widget_builder.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/desks/default_desk_button.h"
#include "ash/wm/desks/desk.h"
#include "ash/wm/desks/desk_action_button.h"
@ -9527,7 +9526,7 @@ TEST_P(DeskBarTest, Basic) {
UpdateDisplay("800x600");
const int expected_expanded_overview_height =
IsForestFeatureEnabled() ? 114 : 98;
features::IsForestFeatureEnabled() ? 114 : 98;
const DeskBarTestBasicCase tests[] = {
{.test_name = "single desk + bottom shelf + saved desks",
@ -9661,7 +9660,7 @@ TEST_P(DeskBarTest, BasicSecondaryDisplay) {
ASSERT_TRUE(desk_bar_widget);
const int expected_expanded_overview_height =
IsForestFeatureEnabled() ? 114 : 98;
features::IsForestFeatureEnabled() ? 114 : 98;
if (bar_type_ == DeskBarViewBase::Type::kOverview) {
EXPECT_THAT(desk_bar_widget->GetWindowBoundsInScreen(),

@ -21,7 +21,6 @@
#include "ash/shell.h"
#include "ash/style/close_button.h"
#include "ash/style/icon_button.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/desks/desk_action_button.h"
#include "ash/wm/desks/desk_action_context_menu.h"
#include "ash/wm/desks/desk_action_view.h"
@ -637,7 +636,7 @@ TEST_F(SavedDeskTest, NoAppSplitScreenLabelOnSavedDeskGridShow) {
// With forest, the saved desk library button is hidden once we snap a
// window. Therefore, we cannot show the grid while the labels are shown.
// TODO(sammiequon): Remove this test once forest is fully launched.
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
return;
}

@ -12,6 +12,7 @@
#include "ash/app_list/app_list_controller_impl.h"
#include "ash/cancel_mode.h"
#include "ash/capture_mode/capture_mode_controller.h"
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/public/cpp/saved_desk_delegate.h"
#include "ash/public/cpp/shell_window_ids.h"
@ -20,7 +21,6 @@
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/utility/forest_util.h"
#include "ash/utility/occlusion_tracker_pauser.h"
#include "ash/wallpaper/views/wallpaper_view.h"
#include "ash/wallpaper/views/wallpaper_widget_controller.h"
@ -449,7 +449,7 @@ void LockStateController::RequestShutdown(ShutdownReason reason) {
}
HideAndMaybeLockCursor(/*lock=*/true);
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
SessionStateChangeWithInformedRestore(RequestedSessionState::kShutdown);
} else {
StartSessionStateChange(RequestedSessionState::kShutdown);
@ -461,7 +461,7 @@ void LockStateController::RequestCancelableShutdown(ShutdownReason reason) {
shutdown_canceled_ = false;
HideAndMaybeLockCursor(/*lock=*/false);
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
SessionStateChangeWithInformedRestore(
RequestedSessionState::kCancelableShutdown);
} else {
@ -483,7 +483,7 @@ bool LockStateController::MaybeCancelShutdownAnimation() {
SessionStateAnimator::ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS,
SessionStateAnimator::ANIMATION_SPEED_REVERT_SHUTDOWN);
shutdown_canceled_ = true;
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
// Shutdown maybe canceled before or after image saved. So we need to delete
// both here and `OnImageSaved`.
DeleteInformedRestoreImage(informed_restore_image_callback_for_test_,
@ -496,7 +496,7 @@ bool LockStateController::MaybeCancelShutdownAnimation() {
void LockStateController::RequestRestart(
power_manager::RequestRestartReason reason,
const std::string& description) {
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
HideAndMaybeLockCursor(/*lock=*/false);
restart_callback_ =
base::BindOnce(&LockStateController::DoRestart, base::Unretained(this),
@ -508,7 +508,7 @@ void LockStateController::RequestRestart(
}
void LockStateController::RequestSignOut() {
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
SessionStateChangeWithInformedRestore(RequestedSessionState::kSignOut);
} else {
Shell::Get()->session_controller()->RequestSignOut();

@ -31,7 +31,6 @@
#include "ash/style/rounded_label_widget.h"
#include "ash/style/typography.h"
#include "ash/system/toast/toast_manager_impl.h"
#include "ash/utility/forest_util.h"
#include "ash/wallpaper/wallpaper_controller_impl.h"
#include "ash/wm/desks/default_desk_button.h"
#include "ash/wm/desks/desk_bar_view_base.h"
@ -538,7 +537,7 @@ bool ShouldShowBirchBar(aura::Window* root_window) {
// disabled by users. We don't need to worry about showing/hiding the bar
// dynamically on primary/secondary user switch because we exit overview when
// we switch users.
return IsForestFeatureEnabled() &&
return features::IsForestFeatureEnabled() &&
Shell::Get()->session_controller()->IsUserPrimary() &&
BirchBarController::Get()->GetShowBirchSuggestions() &&
!SplitViewController::Get(root_window)->InSplitViewMode();
@ -546,7 +545,7 @@ bool ShouldShowBirchBar(aura::Window* root_window) {
bool ShouldShowPineDialog(aura::Window* root_window) {
return root_window == Shell::GetPrimaryRootWindow() &&
IsForestFeatureEnabled() &&
features::IsForestFeatureEnabled() &&
!!Shell::Get()->pine_controller()->contents_data();
}
@ -705,7 +704,7 @@ void OverviewGrid::PrepareForOverview() {
OverviewEnterExitType enter_exit_type =
overview_session_->enter_exit_overview_type();
if (features::IsOakFeatureEnabled() || IsForestFeatureEnabled()) {
if (features::IsOakFeatureEnabled() || features::IsForestFeatureEnabled()) {
scoped_overview_wallpaper_clipper_ =
std::make_unique<ScopedOverviewWallpaperClipper>(
this, enter_exit_type == OverviewEnterExitType::kPine);
@ -815,7 +814,7 @@ void OverviewGrid::PositionWindows(
// Create a feedback button that shows even when no items are present (e.g.,
// for Pine).
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
UpdateFeedbackButton();
}
@ -1697,7 +1696,7 @@ gfx::Rect OverviewGrid::GetGridEffectiveBounds() const {
}
gfx::Insets OverviewGrid::GetGridHorizontalPaddings() const {
if (!features::IsOakFeatureEnabled() && !IsForestFeatureEnabled()) {
if (!features::IsOakFeatureEnabled() && !features::IsForestFeatureEnabled()) {
return gfx::Insets();
}
@ -1729,7 +1728,7 @@ gfx::Insets OverviewGrid::GetGridHorizontalPaddings() const {
gfx::Insets OverviewGrid::GetGridVerticalPaddings() const {
const bool oak_enabled =
features::IsOakFeatureEnabled() || IsForestFeatureEnabled();
features::IsOakFeatureEnabled() || features::IsForestFeatureEnabled();
// Use compact paddings for partial overview.
if (oak_enabled &&
@ -2326,7 +2325,7 @@ void OverviewGrid::RefreshGridBounds(bool animate) {
base::DoNothing());
}
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
UpdateFeedbackButton();
}
}
@ -3069,7 +3068,7 @@ bool OverviewGrid::FitWindowRectsInBounds(
void OverviewGrid::MaybeCenterOverviewItems(
const base::flat_set<OverviewItemBase*>& ignored_items,
std::vector<gfx::RectF>& out_window_rects) {
if (!features::IsOakFeatureEnabled() && !IsForestFeatureEnabled()) {
if (!features::IsOakFeatureEnabled() && !features::IsForestFeatureEnabled()) {
return;
}
@ -3310,7 +3309,7 @@ void OverviewGrid::OnBirchBarLayoutChanged(
}
void OverviewGrid::RefreshDesksWidgets(bool visible) {
if (!IsForestFeatureEnabled()) {
if (!features::IsForestFeatureEnabled()) {
return;
}
@ -3506,7 +3505,7 @@ void OverviewGrid::UpdateFasterSplitViewWidget() {
}
void OverviewGrid::UpdateFeedbackButton() {
CHECK(IsForestFeatureEnabled());
CHECK(features::IsForestFeatureEnabled());
// Only show the feedback button on the primary display.
if (SplitViewController::Get(root_window_)->InSplitViewMode() ||

@ -8,6 +8,7 @@
#include "ash/accessibility/accessibility_controller.h"
#include "ash/app_list/app_list_controller_impl.h"
#include "ash/constants/ash_features.h"
#include "ash/frame_throttler/frame_throttling_controller.h"
#include "ash/metrics/user_metrics_recorder.h"
#include "ash/public/cpp/window_properties.h"
@ -16,7 +17,6 @@
#include "ash/screen_util.h"
#include "ash/shell.h"
#include "ash/style/rounded_label_widget.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/desks/desk.h"
#include "ash/wm/desks/desk_textfield.h"
#include "ash/wm/desks/desks_util.h"
@ -215,7 +215,7 @@ void OverviewSession::Init(const aura::Window::Windows& windows,
}
// Create this before the birch bar widget.
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
birch_bar_controller_ = std::make_unique<BirchBarController>(
/*from_pine_service=*/enter_exit_overview_type_ ==
OverviewEnterExitType::kPine);
@ -1731,7 +1731,7 @@ void OverviewSession::OnSplitViewStateChanged(
// Entering or exiting splitview is unexpected behavior in an informed restore
// overview session.
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
CHECK(!Shell::Get()->pine_controller()->contents_data());
}

@ -39,7 +39,6 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/raster_scale_change_tracker.h"
#include "ash/test/test_window_builder.h"
#include "ash/utility/forest_util.h"
#include "ash/wallpaper/views/wallpaper_view.h"
#include "ash/wallpaper/views/wallpaper_widget_controller.h"
#include "ash/wm/desks/desk.h"
@ -1913,7 +1912,7 @@ TEST_P(OverviewSessionTest, NoWindowsIndicatorPosition) {
// centered vertically.
gfx::Point no_windows_centerpoint =
no_windows_widget->GetWindowBoundsInScreen().CenterPoint();
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
EXPECT_EQ(200, no_windows_centerpoint.x());
EXPECT_GT(no_windows_centerpoint.y(), kDeskBarZeroStateHeight);
EXPECT_LT(no_windows_centerpoint.y(),
@ -1931,7 +1930,7 @@ TEST_P(OverviewSessionTest, NoWindowsIndicatorPosition) {
display::Display::RotationSource::ACTIVE);
no_windows_centerpoint =
no_windows_widget->GetWindowBoundsInScreen().CenterPoint();
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
EXPECT_EQ(150, no_windows_centerpoint.x());
EXPECT_GT(no_windows_centerpoint.y(), kDeskBarZeroStateHeight);
EXPECT_LT(no_windows_centerpoint.y(),
@ -1991,7 +1990,7 @@ TEST_P(OverviewSessionTest, OverviewGridBounds) {
const gfx::Rect shelf_bounds = shelf->GetIdealBounds();
EXPECT_FALSE(GetGridBounds().Intersects(shelf_bounds));
if (!IsForestFeatureEnabled()) {
if (!features::IsForestFeatureEnabled()) {
const gfx::Rect hotseat_bounds =
shelf->hotseat_widget()->GetWindowBoundsInScreen();
EXPECT_FALSE(GetGridBounds().Intersects(hotseat_bounds));
@ -2029,7 +2028,7 @@ TEST_P(OverviewSessionTest, NoWindowsIndicatorPositionSplitview) {
// bar for the y location.
gfx::Point no_windows_centerpoint =
no_windows_widget->GetWindowBoundsInScreen().CenterPoint();
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
EXPECT_EQ(expected_x, no_windows_centerpoint.x());
EXPECT_GT(no_windows_centerpoint.y(), kDeskBarZeroStateHeight);
EXPECT_LT(no_windows_centerpoint.y(), 300 - workarea_bottom_inset);
@ -2043,7 +2042,7 @@ TEST_P(OverviewSessionTest, NoWindowsIndicatorPositionSplitview) {
no_windows_centerpoint =
no_windows_widget->GetWindowBoundsInScreen().CenterPoint();
expected_x = /*bounds_right=*/(200 - 4) / 2;
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
EXPECT_EQ(expected_x, no_windows_centerpoint.x());
EXPECT_GT(no_windows_centerpoint.y(), kDeskBarZeroStateHeight);
EXPECT_LT(no_windows_centerpoint.y(), 300 - workarea_bottom_inset);
@ -5628,7 +5627,7 @@ class FloatOverviewSessionTest : public OverviewTestBase {
// it is not true on any of the root windows.
bool IsFloatContainerNormalStacked() const {
for (aura::Window* root : Shell::GetAllRootWindows()) {
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
// The float container should be the top-most child of the
// `ShutdownScreenshotContainer` when the feature `ForestFeature` is
// enabled.

@ -4,11 +4,11 @@
#include "ash/wm/overview/overview_test_util.h"
#include "ash/constants/ash_features.h"
#include "ash/public/cpp/overview_test_api.h"
#include "ash/public/cpp/shelf_config.h"
#include "ash/shell.h"
#include "ash/test/ash_test_util.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/overview/overview_focus_cycler_old.h"
#include "ash/wm/overview/overview_grid.h"
@ -126,7 +126,7 @@ OverviewItemBase* GetOverviewItemForWindow(aura::Window* window) {
gfx::Rect ShrinkBoundsByHotseatInset(const gfx::Rect& rect) {
// TODO(sammiequon): Forest feature shrinks if the home launcher is visible,
// and no-ops otherwise. Determine if we need the home launcher logic here.
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
return rect;
}

@ -7,6 +7,7 @@
#include <utility>
#include "ash/accessibility/accessibility_controller.h"
#include "ash/constants/ash_features.h"
#include "ash/public/cpp/shelf_config.h"
#include "ash/public/cpp/window_properties.h"
#include "ash/root_window_controller.h"
@ -14,7 +15,6 @@
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shell.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/cleanup_animation_observer.h"
#include "ash/wm/overview/delayed_animation_observer_impl.h"
@ -287,7 +287,7 @@ gfx::Rect GetGridBoundsInScreen(
hotseat_state == HotseatState::kShownHomeLauncher;
const bool oak_enabled =
features::IsOakFeatureEnabled() || IsForestFeatureEnabled();
features::IsOakFeatureEnabled() || features::IsForestFeatureEnabled();
// Use the default hotseat size here to avoid the possible re-layout
// due to the update in HotseatWidget::is_forced_dense_.

@ -8,7 +8,6 @@
#include "ash/display/screen_orientation_controller_test_api.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/desks/desk.h"
#include "ash/wm/desks/desk_mini_view.h"
#include "ash/wm/desks/desks_constants.h"
@ -587,7 +586,7 @@ TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest,
const gfx::Rect desk_bar_bounds = desks_bar_view->GetBoundsInScreen();
const gfx::Rect first_item_bounds =
gfx::ToEnclosedRect(overview_grid()->window_list()[0]->target_bounds());
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
// With forest, a little overlap is ok since the desk bar is transparent.
// TODO(sammiequon|zxdan): Check if this gap is okay.
EXPECT_NEAR(desk_bar_bounds.bottom(), first_item_bounds.y(), 20);

@ -5,6 +5,7 @@
#include "ash/wm/window_restore/pine_controller.h"
#include "ash/birch/birch_model.h"
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/constants/ash_switches.h"
#include "ash/constants/notifier_catalogs.h"
@ -16,12 +17,12 @@
#include "ash/public/cpp/window_properties.h"
#include "ash/screen_util.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_id.h"
#include "ash/style/dark_light_mode_controller_impl.h"
#include "ash/style/system_dialog_delegate_view.h"
#include "ash/system/toast/toast_manager_impl.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/desks/desks_util.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/overview/overview_grid.h"
@ -85,6 +86,11 @@ PrefService* GetActivePrefService() {
// Returns true if this is the first time login and we should show the informed
// restore onboarding message.
bool ShouldStartInformedRestoreOnboarding() {
// This dialog is modal and can interfere with some browser tests that aren't
// expecting it. Do not show it by default.
if (Shell::Get()->shell_delegate()->IsNoFirstRunSwitchOn()) {
return false;
}
PrefService* prefs = GetActivePrefService();
return prefs && prefs->GetBoolean(prefs::kShowInformedRestoreOnboarding);
}
@ -221,7 +227,7 @@ void PineController::MaybeStartPineOverviewSessionDevAccelerator() {
void PineController::MaybeStartPineOverviewSession(
std::unique_ptr<InformedRestoreContentsData> contents_data) {
CHECK(IsForestFeatureEnabled());
CHECK(features::IsForestFeatureEnabled());
if (OverviewController::Get()->InOverviewSession()) {
return;
@ -296,7 +302,7 @@ void PineController::OnOverviewModeEndingAnimationComplete(bool canceled) {
// In multi-user scenario, forest may have been available for the user that
// started overview, but not for the current user. (Switching users ends
// overview.)
if (!IsForestFeatureEnabled()) {
if (!features::IsForestFeatureEnabled()) {
return;
}

@ -630,6 +630,13 @@ IN_PROC_BROWSER_TEST_F(FullRestoreAppLaunchHandlerBrowserTest,
// restore finishes.
IN_PROC_BROWSER_TEST_F(FullRestoreAppLaunchHandlerBrowserTest,
RestoreAndLaunchBrowserWithClickRestore) {
// TODO(http://b/328779923): This test tests clicking a notification that will
// not be shown if forest feature is enabled. Remove this test once forest
// feature can no longer be disabled.
if (ash::features::IsForestFeatureEnabled()) {
GTEST_SKIP() << "Skipping test body for Forest Feature.";
}
base::HistogramTester histogram_tester;
size_t count = BrowserList::GetInstance()->size();
@ -684,6 +691,13 @@ IN_PROC_BROWSER_TEST_F(FullRestoreAppLaunchHandlerBrowserTest,
// when |kShowPostRebootNotification| pref is set.
IN_PROC_BROWSER_TEST_F(FullRestoreAppLaunchHandlerBrowserTest,
RestoreWithPostRebootTitle) {
// TODO(http://b/328779923): This test tests checking a notification that will
// not be shown if forest feature is enabled. Remove this test once forest
// feature can no longer be disabled.
if (ash::features::IsForestFeatureEnabled()) {
GTEST_SKIP() << "Skipping test body for Forest Feature.";
}
base::HistogramTester histogram_tester;
// Add the chrome browser launch info.
SaveBrowserAppLaunchInfo(kWindowId1);

@ -4,8 +4,8 @@
#include "chrome/browser/ash/app_restore/full_restore_prefs.h"
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/utility/forest_util.h"
#include "ash/wm/window_restore/window_restore_util.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/common/pref_names.h"
@ -24,7 +24,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) {
static_cast<int>(RestoreOption::kAskEveryTime),
user_prefs::PrefRegistrySyncable::SYNCABLE_OS_PREF);
if (IsForestFeatureFlagEnabled()) {
if (features::IsForestFeatureEnabled()) {
registry->RegisterBooleanPref(prefs::kShowInformedRestoreOnboarding, true);
registry->RegisterIntegerPref(prefs::kInformedRestoreNudgeShownCount, 0);
registry->RegisterTimePref(prefs::kInformedRestoreNudgeLastShown,

@ -18,7 +18,6 @@
#include "ash/metrics/login_unlock_throughput_recorder.h"
#include "ash/public/cpp/notification_utils.h"
#include "ash/shell.h"
#include "ash/utility/forest_util.h"
#include "ash/webui/settings/public/constants/routes.mojom.h"
#include "ash/webui/settings/public/constants/setting.mojom-shared.h"
#include "ash/wm/desks/templates/saved_desk_controller.h"
@ -396,7 +395,7 @@ void FullRestoreService::Init(bool& show_notification) {
MaybeInitiateAdminTemplateAutoLaunch();
break;
case RestoreOption::kDoNotRestore:
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
MaybeShowInformedRestoreOnboarding(/*restore_on=*/false);
}
::full_restore::FullRestoreSaveHandler::GetInstance()->AllowSave();
@ -656,7 +655,8 @@ void FullRestoreService::MaybeShowRestoreNotification(const std::string& id,
}
// Do not show the notification if we have no restore data.
if (!IsForestFeatureEnabled() && !app_launch_handler_->HasRestoreData()) {
if (!features::IsForestFeatureEnabled() &&
!app_launch_handler_->HasRestoreData()) {
return;
}
@ -675,7 +675,7 @@ void FullRestoreService::MaybeShowRestoreNotification(const std::string& id,
const bool last_session_crashed = id == kRestoreForCrashNotificationId;
if (!app_launch_handler_->HasRestoreData()) {
CHECK(IsForestFeatureEnabled());
CHECK(features::IsForestFeatureEnabled());
MaybeShowInformedRestoreOnboarding(/*restore_on=*/true);
return;
}
@ -695,7 +695,7 @@ void FullRestoreService::MaybeShowRestoreNotification(const std::string& id,
->RecordPostLoginFullRestoreShown();
}
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
CHECK(delegate_);
InitInformedRestoreContentsData(last_session_crashed);

@ -1029,16 +1029,6 @@ class ForestFullRestoreServiceTest : public FullRestoreServiceTest {
ForestFullRestoreServiceTest& operator=(const ForestFullRestoreServiceTest&) =
delete;
~ForestFullRestoreServiceTest() override = default;
void SetUp() override {
switches::SetIgnoreForestSecretKeyForTest(true);
FullRestoreServiceTest::SetUp();
}
void TearDown() override {
switches::SetIgnoreForestSecretKeyForTest(false);
FullRestoreServiceTest::TearDown();
}
};
// If the system is crash, and there is no full restore file, don't show the
@ -1224,16 +1214,6 @@ class ForestFullRestoreServiceTestHavingFullRestoreFile
ForestFullRestoreServiceTestHavingFullRestoreFile& operator=(
const ForestFullRestoreServiceTestHavingFullRestoreFile&) = delete;
~ForestFullRestoreServiceTestHavingFullRestoreFile() override = default;
void SetUp() override {
switches::SetIgnoreForestSecretKeyForTest(true);
FullRestoreServiceTestHavingFullRestoreFile::SetUp();
}
void TearDown() override {
switches::SetIgnoreForestSecretKeyForTest(false);
FullRestoreServiceTestHavingFullRestoreFile::TearDown();
}
};
// If the system is crash, the delegate is notified.
@ -1320,16 +1300,6 @@ class ForestFullRestoreServiceMultipleUsersTest
ForestFullRestoreServiceMultipleUsersTest& operator=(
const ForestFullRestoreServiceMultipleUsersTest&) = delete;
~ForestFullRestoreServiceMultipleUsersTest() override = default;
void SetUp() override {
switches::SetIgnoreForestSecretKeyForTest(true);
FullRestoreServiceMultipleUsersTest::SetUp();
}
void TearDown() override {
switches::SetIgnoreForestSecretKeyForTest(false);
FullRestoreServiceMultipleUsersTest::TearDown();
}
};
// Verify the full restore init process when 2 users login at the same time,

@ -5,7 +5,6 @@
#include "ash/accelerators/accelerator_controller_impl.h"
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/constants/ash_switches.h"
#include "ash/shell.h"
#include "ash/style/system_dialog_delegate_view.h"
#include "ash/test/ash_test_util.h"
@ -108,14 +107,11 @@ class BrowsersWaiter : public BrowserListObserver {
class InformedRestoreTest : public InProcessBrowserTest {
public:
InformedRestoreTest() {
switches::SetIgnoreForestSecretKeyForTest(true);
set_launch_browser_for_testing(nullptr);
}
InformedRestoreTest(const InformedRestoreTest&) = delete;
InformedRestoreTest& operator=(const InformedRestoreTest&) = delete;
~InformedRestoreTest() override {
switches::SetIgnoreForestSecretKeyForTest(false);
}
~InformedRestoreTest() override = default;
void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();

@ -7,7 +7,6 @@
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/public/cpp/app_list/app_list_types.h"
#include "ash/utility/forest_util.h"
#include "base/functional/bind.h"
#include "chrome/browser/ash/file_manager/fileapi_util.h"
#include "chrome/browser/ash/file_suggest/drive_file_suggestion_provider.h"
@ -37,7 +36,7 @@ FileSuggestKeyedService::FileSuggestKeyedService(
proto_.Init();
if (features::IsLauncherContinueSectionWithRecentsEnabled() ||
IsForestFeatureEnabled()) {
features::IsForestFeatureEnabled()) {
drive_file_suggestion_provider_ =
std::make_unique<DriveRecentFileSuggestionProvider>(
profile, base::BindRepeating(

@ -251,6 +251,12 @@ INSTANTIATE_TEST_SUITE_P(UseDriveRecents,
// suggest cache is empty.
IN_PROC_BROWSER_TEST_P(FileSuggestKeyedServiceBrowserTest,
QueryWithEmptyCache) {
// TODO(http://b/349164737): Re-enable this test with forest feature enabled.
if (ash::features::IsForestFeatureEnabled() && !UseDriveRecents()) {
GTEST_SKIP() << "Skipping test body for Forest Feature enabled and Drive "
"Recents disabled.";
}
base::HistogramTester histogram_tester;
auto* fake_drivefs = GetFakeDriveFsForProfile(browser()->profile());
@ -303,6 +309,11 @@ IN_PROC_BROWSER_TEST_P(FileSuggestKeyedServiceBrowserTest,
// the item suggest cache correctly.
IN_PROC_BROWSER_TEST_P(FileSuggestKeyedServiceBrowserTest,
RespondToItemSuggestCacheUpdate) {
// TODO(http://b/349164737): Re-enable this test with forest feature enabled.
if (ash::features::IsForestFeatureEnabled() && !UseDriveRecents()) {
GTEST_SKIP() << "Skipping test body for Forest Feature enabled and Drive "
"Recents disabled.";
}
base::HistogramTester histogram_tester;
Profile* profile = browser()->profile();
@ -428,6 +439,12 @@ IN_PROC_BROWSER_TEST_P(FileSuggestKeyedServiceBrowserTest,
// the item suggest cache correctly when item fetch fails.
IN_PROC_BROWSER_TEST_P(FileSuggestKeyedServiceBrowserTest,
RespondToItemSuggestCacheInvalidUpdate) {
// TODO(http://b/349164737): Re-enable this test with forest feature enabled.
if (ash::features::IsForestFeatureEnabled() && !UseDriveRecents()) {
GTEST_SKIP() << "Skipping test body for Forest Feature enabled and Drive "
"Recents disabled.";
}
base::HistogramTester histogram_tester;
Profile* profile = browser()->profile();
@ -503,6 +520,12 @@ IN_PROC_BROWSER_TEST_P(FileSuggestKeyedServiceBrowserTest,
// the item suggest cache correctly if some item fetches fail.
IN_PROC_BROWSER_TEST_P(FileSuggestKeyedServiceBrowserTest,
RespondToItemSuggestCachePartiallyInvalidUpdate) {
// TODO(http://b/349164737): Re-enable this test with forest feature enabled.
if (ash::features::IsForestFeatureEnabled() && !UseDriveRecents()) {
GTEST_SKIP() << "Skipping test body for Forest Feature enabled and Drive "
"Recents disabled.";
}
base::HistogramTester histogram_tester;
Profile* profile = browser()->profile();

@ -6,10 +6,10 @@
#include <string>
#include "ash/constants/ash_features.h"
#include "ash/constants/notifier_catalogs.h"
#include "ash/public/cpp/notification_utils.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/utility/forest_util.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "base/strings/string_util.h"
@ -39,7 +39,8 @@ ReleaseNotesNotification::~ReleaseNotesNotification() {}
void ReleaseNotesNotification::MaybeShowReleaseNotes() {
release_notes_storage_ = std::make_unique<ReleaseNotesStorage>(profile_);
if (!release_notes_storage_->ShouldNotify() || IsForestFeatureEnabled()) {
if (!release_notes_storage_->ShouldNotify() ||
features::IsForestFeatureEnabled()) {
return;
}
ShowReleaseNotesNotification();

@ -8,7 +8,6 @@
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_switches.h"
#include "ash/utility/forest_util.h"
#include "ash/webui/help_app_ui/buildflags.h"
#include "ash/webui/help_app_ui/help_app_manager.h"
#include "ash/webui/help_app_ui/help_app_manager_factory.h"
@ -388,6 +387,11 @@ IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest, HelpAppV2ReleaseNotesMetrics) {
// Test that clicking the release notes notification opens Help App.
IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest,
HelpAppV2LaunchReleaseNotesFromNotification) {
// TODO(http://b/349164737): Re-enable this test with forest feature enabled.
if (ash::features::IsForestFeatureEnabled()) {
GTEST_SKIP() << "Skipping test body for Forest Feature.";
}
WaitForTestSystemAppInstall();
base::UserActionTester user_action_tester;
auto display_service =
@ -435,7 +439,6 @@ IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest,
// Test that the background page can trigger the release notes notification.
IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest,
HelpAppV2ReleaseNotesNotificationFromBackground) {
ash::switches::SetIgnoreForestSecretKeyForTest(true);
WaitForTestSystemAppInstall();
content::WebContents* web_contents = LaunchApp(SystemWebAppType::HELP);
auto display_service =
@ -461,7 +464,7 @@ IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest,
EXPECT_EQ(true,
content::EvalJs(
SandboxedWebUiAppTestBase::GetAppFrame(web_contents), kScript));
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
EXPECT_EQ(profile()->GetPrefs()->GetInteger(
prefs::kReleaseNotesSuggestionChipTimesLeftToShow),
0);
@ -482,7 +485,7 @@ IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest,
// Assert that the notification really is there.
auto notifications = display_service->GetDisplayedNotificationsForType(
NotificationHandler::Type::TRANSIENT);
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
ASSERT_EQ(0u, notifications.size());
} else {
ASSERT_EQ(1u, notifications.size());
@ -496,7 +499,7 @@ IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest,
"show_release_notes_notification",
std::nullopt, std::nullopt);
#if BUILDFLAG(ENABLE_CROS_HELP_APP)
if (!IsForestFeatureEnabled()) {
if (!features::IsForestFeatureEnabled()) {
EXPECT_NO_FATAL_FAILURE(navigation_observer.Wait());
EXPECT_EQ(expected_url, GetActiveWebContents()->GetVisibleURL());
}
@ -504,13 +507,11 @@ IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTest,
// We just have the original browser. No new app opens.
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
#endif
ash::switches::SetIgnoreForestSecretKeyForTest(false);
}
IN_PROC_BROWSER_TEST_P(
HelpAppIntegrationTestWithHelpAppOpensInsteadOfReleaseNotesNotification,
OpensHelpApp) {
ash::switches::SetIgnoreForestSecretKeyForTest(true);
WaitForTestSystemAppInstall();
base::HistogramTester histogram_tester;
GURL expected_trusted_frame_url = GURL(kExploreUpdatesPageUrl);
@ -534,7 +535,7 @@ IN_PROC_BROWSER_TEST_P(
prefs::kReleaseNotesSuggestionChipTimesLeftToShow),
0);
#if BUILDFLAG(ENABLE_CROS_HELP_APP)
if (!IsForestFeatureEnabled()) {
if (!features::IsForestFeatureEnabled()) {
EXPECT_NO_FATAL_FAILURE(navigation_observer.Wait());
EXPECT_EQ(expected_trusted_frame_url,
GetActiveWebContents()->GetVisibleURL());
@ -549,7 +550,6 @@ IN_PROC_BROWSER_TEST_P(
"Discover.Overall.AppLaunched",
apps::LaunchSource::kFromReleaseNotesNotification, 0);
#endif
ash::switches::SetIgnoreForestSecretKeyForTest(false);
}
IN_PROC_BROWSER_TEST_P(HelpAppIntegrationTestWithBirchFeatureEnabled,

@ -5,7 +5,6 @@
#include "chrome/browser/ash/system_web_apps/apps/help_app/help_app_notification_controller.h"
#include "ash/constants/ash_features.h"
#include "ash/utility/forest_util.h"
#include "base/logging.h"
#include "base/version.h"
#include "chrome/browser/ash/release_notes/release_notes_notification.h"
@ -67,7 +66,7 @@ void HelpAppNotificationController::MaybeShowReleaseNotesNotification() {
features::kReleaseNotesNotificationAlwaysEligible)) {
return;
}
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
return;
}
ReleaseNotesStorage release_notes_storage(profile_);

@ -7,8 +7,6 @@
#include <memory>
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_switches.h"
#include "ash/utility/forest_util.h"
#include "base/feature_list.h"
#include "base/memory/raw_ptr.h"
#include "base/test/scoped_feature_list.h"
@ -155,7 +153,6 @@ TEST_F(HelpAppNotificationControllerTestWithHelpAppOpensInsteadDisabled,
TEST_F(HelpAppNotificationControllerTestWithHelpAppOpensInsteadDisabled,
ShowsReleaseNotesNotificationIfShownInOlderMilestone) {
ash::switches::SetIgnoreForestSecretKeyForTest(true);
Profile* profile = CreateRegularProfile();
profile->GetPrefs()->SetInteger(prefs::kHelpAppNotificationLastShownMilestone,
20);
@ -163,7 +160,7 @@ TEST_F(HelpAppNotificationControllerTestWithHelpAppOpensInsteadDisabled,
std::make_unique<HelpAppNotificationController>(profile);
controller->MaybeShowReleaseNotesNotification();
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
EXPECT_EQ(0, notification_count_);
EXPECT_EQ(false, HasReleaseNotesNotification());
EXPECT_EQ(20, profile->GetPrefs()->GetInteger(
@ -175,7 +172,6 @@ TEST_F(HelpAppNotificationControllerTestWithHelpAppOpensInsteadDisabled,
profile->GetPrefs()->GetInteger(
prefs::kHelpAppNotificationLastShownMilestone));
}
ash::switches::SetIgnoreForestSecretKeyForTest(false);
}
TEST_F(HelpAppNotificationControllerTestWithHelpAppOpensInsteadDisabled,
@ -207,7 +203,6 @@ TEST_F(HelpAppNotificationControllerTestWithHelpAppOpensInsteadDisabled,
TEST_F(HelpAppNotificationControllerTestWithHelpAppOpensInsteadDisabled,
DoesNotShowMoreThanOneNotificationPerMilestone) {
ash::switches::SetIgnoreForestSecretKeyForTest(true);
Profile* profile = CreateChildProfile();
profile->GetPrefs()->SetInteger(prefs::kHelpAppNotificationLastShownMilestone,
91);
@ -216,7 +211,7 @@ TEST_F(HelpAppNotificationControllerTestWithHelpAppOpensInsteadDisabled,
controller->MaybeShowReleaseNotesNotification();
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
EXPECT_EQ(0, notification_count_);
EXPECT_EQ(false, HasReleaseNotesNotification());
} else {
@ -226,21 +221,18 @@ TEST_F(HelpAppNotificationControllerTestWithHelpAppOpensInsteadDisabled,
controller->MaybeShowReleaseNotesNotification();
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
EXPECT_EQ(0, notification_count_);
EXPECT_EQ(false, HasReleaseNotesNotification());
} else {
EXPECT_EQ(1, notification_count_);
EXPECT_EQ(true, HasReleaseNotesNotification());
}
ash::switches::SetIgnoreForestSecretKeyForTest(false);
}
// Tests for suggestion chips.
TEST_F(HelpAppNotificationControllerTestWithHelpAppOpensInsteadDisabled,
UpdatesReleaseNotesChipPrefWhenReleaseNotesNotificationShown) {
ash::switches::SetIgnoreForestSecretKeyForTest(true);
Profile* profile = CreateRegularProfile();
profile->GetPrefs()->SetInteger(prefs::kHelpAppNotificationLastShownMilestone,
20);
@ -251,14 +243,13 @@ TEST_F(HelpAppNotificationControllerTestWithHelpAppOpensInsteadDisabled,
prefs::kReleaseNotesSuggestionChipTimesLeftToShow));
controller->MaybeShowReleaseNotesNotification();
if (IsForestFeatureEnabled()) {
if (features::IsForestFeatureEnabled()) {
EXPECT_EQ(0, profile->GetPrefs()->GetInteger(
prefs::kReleaseNotesSuggestionChipTimesLeftToShow));
} else {
EXPECT_EQ(3, profile->GetPrefs()->GetInteger(
prefs::kReleaseNotesSuggestionChipTimesLeftToShow));
}
ash::switches::SetIgnoreForestSecretKeyForTest(false);
}
// Tests that help app opens instead of release notes notification by default.
@ -281,7 +272,6 @@ TEST_F(HelpAppNotificationControllerTest, DoesNotShowNotification) {
// Tests that release notes don't auto open if the birch feature is enabled.
TEST_F(HelpAppNotificationControllerTest,
DoesNotOpenHelpAppIfBirchFeatureEnabled) {
ash::switches::SetIgnoreForestSecretKeyForTest(true);
TurnOnBirchFeature();
Profile* profile = CreateRegularProfile();
profile->GetPrefs()->SetInteger(prefs::kHelpAppNotificationLastShownMilestone,
@ -295,7 +285,6 @@ TEST_F(HelpAppNotificationControllerTest,
EXPECT_EQ(false, HasReleaseNotesNotification());
EXPECT_EQ(91, profile->GetPrefs()->GetInteger(
prefs::kHelpAppNotificationLastShownMilestone));
ash::switches::SetIgnoreForestSecretKeyForTest(false);
}
} // namespace ash

@ -268,16 +268,6 @@ class BirchBrowserTest : public InProcessBrowserTest {
BirchBrowserTest(const BirchBrowserTest&) = delete;
BirchBrowserTest& operator=(const BirchBrowserTest&) = delete;
void SetUp() override {
switches::SetIgnoreForestSecretKeyForTest(true);
InProcessBrowserTest::SetUp();
}
void TearDown() override {
InProcessBrowserTest::TearDown();
switches::SetIgnoreForestSecretKeyForTest(false);
}
void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();
// Clear out the existing NewWindowDelegateProvider so we can replace it

@ -9,7 +9,6 @@
#include "ash/birch/birch_model.h"
#include "ash/calendar/calendar_controller.h"
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_switches.h"
#include "ash/shell.h"
#include "ash/system/time/calendar_unittest_utils.h"
#include "base/check.h"
@ -72,13 +71,8 @@ class CountingCalendarFetcher : public BirchCalendarFetcher {
// a BirchModel) needed by the test.
class BirchCalendarProviderTest : public BrowserWithTestWindowTest {
public:
BirchCalendarProviderTest() {
switches::SetIgnoreForestSecretKeyForTest(true);
feature_list_.InitAndEnableFeature(features::kForestFeature);
}
~BirchCalendarProviderTest() override {
switches::SetIgnoreForestSecretKeyForTest(false);
}
BirchCalendarProviderTest() = default;
~BirchCalendarProviderTest() override = default;
void SetUp() override {
BrowserWithTestWindowTest::SetUp();
@ -94,7 +88,7 @@ class BirchCalendarProviderTest : public BrowserWithTestWindowTest {
}
private:
base::test::ScopedFeatureList feature_list_;
base::test::ScopedFeatureList feature_list_{features::kForestFeature};
std::unique_ptr<calendar_test_utils::CalendarClientTestImpl> calendar_client_;
};

@ -6,7 +6,7 @@
#include <memory>
#include "ash/utility/forest_util.h"
#include "ash/constants/ash_features.h"
#include "base/no_destructor.h"
#include "chrome/browser/ash/file_suggest/file_suggest_keyed_service_factory.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
@ -50,7 +50,7 @@ BirchKeyedService* BirchKeyedServiceFactory::GetService(
content::BrowserContext* context) {
return static_cast<BirchKeyedService*>(
GetInstance()->GetServiceForBrowserContext(
context, /*create=*/IsForestFeatureEnabled()));
context, /*create=*/features::IsForestFeatureEnabled()));
}
std::unique_ptr<KeyedService>

@ -8,7 +8,6 @@
#include <string>
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_switches.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "chrome/browser/ui/ash/birch/birch_keyed_service.h"
@ -21,17 +20,6 @@
namespace ash {
class BirchKeyedServiceFactoryTest : public BrowserWithTestWindowTest {
public:
void SetUp() override {
switches::SetIgnoreForestSecretKeyForTest(true);
BrowserWithTestWindowTest::SetUp();
}
void TearDown() override {
BrowserWithTestWindowTest::TearDown();
switches::SetIgnoreForestSecretKeyForTest(false);
}
protected:
base::test::ScopedFeatureList feature_list_{features::kForestFeature};
};

@ -11,7 +11,6 @@
#include "ash/birch/birch_model.h"
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_pref_names.h"
#include "ash/constants/ash_switches.h"
#include "ash/shell.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
@ -337,8 +336,6 @@ class BirchKeyedServiceTest : public BrowserWithTestWindowTest {
fake_user_manager_(std::make_unique<FakeChromeUserManager>()) {}
void SetUp() override {
switches::SetIgnoreForestSecretKeyForTest(true);
feature_list_.InitWithFeatures(
{features::kForestFeature,
ash::features::kReleaseNotesNotificationAllChannels},
@ -399,7 +396,6 @@ class BirchKeyedServiceTest : public BrowserWithTestWindowTest {
release_notes_storage_ = nullptr;
favicon_service_ = nullptr;
BrowserWithTestWindowTest::TearDown();
switches::SetIgnoreForestSecretKeyForTest(false);
}
void LogIn(const std::string& email) override {

@ -6,7 +6,6 @@
#include "ash/birch/birch_model.h"
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_switches.h"
#include "ash/shell.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/test/scoped_feature_list.h"
@ -78,16 +77,11 @@ history::QueryResults CreateHistoryQueryResults() {
// a BirchModel) needed by the test.
class BirchLastActiveProviderTest : public BrowserWithTestWindowTest {
public:
BirchLastActiveProviderTest() {
switches::SetIgnoreForestSecretKeyForTest(true);
feature_list_.InitAndEnableFeature(features::kForestFeature);
}
~BirchLastActiveProviderTest() override {
switches::SetIgnoreForestSecretKeyForTest(false);
}
BirchLastActiveProviderTest() = default;
~BirchLastActiveProviderTest() override = default;
private:
base::test::ScopedFeatureList feature_list_;
base::test::ScopedFeatureList feature_list_{features::kForestFeature};
};
TEST_F(BirchLastActiveProviderTest, RequestBirchDataFetch) {

@ -65,16 +65,11 @@ class TestFaviconService : public favicon::MockFaviconService {
// a BirchModel) needed by the test.
class BirchMostVisitedProviderTest : public BrowserWithTestWindowTest {
public:
BirchMostVisitedProviderTest() {
switches::SetIgnoreForestSecretKeyForTest(true);
feature_list_.InitAndEnableFeature(features::kForestFeature);
}
~BirchMostVisitedProviderTest() override {
switches::SetIgnoreForestSecretKeyForTest(false);
}
BirchMostVisitedProviderTest() = default;
~BirchMostVisitedProviderTest() override = default;
private:
base::test::ScopedFeatureList feature_list_;
base::test::ScopedFeatureList feature_list_{features::kForestFeature};
};
TEST_F(BirchMostVisitedProviderTest, RequestBirchDataFetch) {

@ -494,3 +494,8 @@ void ChromeShellDelegate::OpenMultitaskingSettings() {
ProfileManager::GetActiveUserProfile(), sub_page_path,
chromeos::settings::mojom::Setting::kSnapWindowSuggestions);
}
bool ChromeShellDelegate::IsNoFirstRunSwitchOn() const {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kNoFirstRun);
}

@ -96,6 +96,7 @@ class ChromeShellDelegate : public ash::ShellDelegate {
ShouldExitFullscreenCallback callback) override;
ash::DeskProfilesDelegate* GetDeskProfilesDelegate() override;
void OpenMultitaskingSettings() override;
bool IsNoFirstRunSwitchOn() const override;
};
#endif // CHROME_BROWSER_UI_ASH_CHROME_SHELL_DELEGATE_H_