glanceables_view_unittest.cc 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 "ash/glanceables/glanceables_view.h"
  5. #include "ash/constants/ash_features.h"
  6. #include "ash/glanceables/glanceables_controller.h"
  7. #include "ash/glanceables/glanceables_welcome_label.h"
  8. #include "ash/shell.h"
  9. #include "ash/test/ash_test_base.h"
  10. #include "base/test/scoped_feature_list.h"
  11. namespace ash {
  12. namespace {
  13. // Use a "no session" test so the glanceables widget is not automatically
  14. // created at the start of the test.
  15. // TODO(crbug.com/1353119): Once glanceables are shown by code in the
  16. // chrome/browser/ash layer, switch this to AshTestBase.
  17. class GlanceablesViewTest : public NoSessionAshTestBase {
  18. protected:
  19. base::test::ScopedFeatureList feature_list_{features::kGlanceables};
  20. };
  21. TEST_F(GlanceablesViewTest, Basics) {
  22. GlanceablesController* controller = Shell::Get()->glanceables_controller();
  23. ASSERT_TRUE(controller);
  24. controller->CreateUi();
  25. GlanceablesView* view = controller->view_for_test();
  26. ASSERT_TRUE(view);
  27. // Welcome label was created.
  28. GlanceablesWelcomeLabel* welcome_label = view->welcome_label_for_test();
  29. ASSERT_TRUE(welcome_label);
  30. EXPECT_FALSE(welcome_label->GetText().empty());
  31. }
  32. } // namespace
  33. } // namespace ash