native_theme_features_unittest.cc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #include "ui/native_theme/native_theme_features.h"
  5. #include "base/test/scoped_feature_list.h"
  6. #include "testing/gtest/include/gtest/gtest.h"
  7. namespace ui {
  8. // The unit test verifies that the Fluent scrollbar feature is enabled
  9. // on Windows when both overlay and fluent scrollbar base features are enabled.
  10. TEST(FluentScrollbarFeatureStateTest, Enabled) {
  11. base::test::ScopedFeatureList scoped_feature_list;
  12. scoped_feature_list.InitWithFeatures(
  13. {features::kOverlayScrollbar, features::kFluentScrollbar}, {});
  14. EXPECT_TRUE(IsOverlayScrollbarEnabled());
  15. #if BUILDFLAG(IS_WIN)
  16. EXPECT_TRUE(IsFluentScrollbarEnabled());
  17. #else
  18. EXPECT_FALSE(IsFluentScrollbarEnabled());
  19. #endif
  20. }
  21. // The unit test verifies that the Fluent scrollbar feature is disabled when
  22. // kOverlayScrollbar base feature is disabled no matter the state of
  23. // kFluentScrollbar.
  24. TEST(FluentScrollbarFeatureStateTest, Disabled) {
  25. base::test::ScopedFeatureList scoped_feature_list;
  26. scoped_feature_list.InitWithFeatures({features::kFluentScrollbar},
  27. {features::kOverlayScrollbar});
  28. EXPECT_FALSE(IsOverlayScrollbarEnabled());
  29. EXPECT_FALSE(IsFluentScrollbarEnabled());
  30. }
  31. // The unit test verifies that the Fluent scrollbar feature is disabled
  32. // by default on all platforms.
  33. TEST(FluentScrollbarFeatureStateTest, DisabledByDefault) {
  34. EXPECT_FALSE(base::FeatureList::IsEnabled(features::kFluentScrollbar));
  35. EXPECT_FALSE(IsFluentScrollbarEnabled());
  36. }
  37. } // namespace ui