window_dimmer_unittest.cc 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2018 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/wm/window_dimmer.h"
  5. #include "ash/test/ash_test_base.h"
  6. #include "ash/test/ash_test_helper.h"
  7. #include "testing/gtest/include/gtest/gtest.h"
  8. #include "ui/aura/test/aura_test_base.h"
  9. #include "ui/aura/test/test_windows.h"
  10. namespace ash {
  11. using WindowDimmerTest = ash::AshTestBase;
  12. // Verify that a window underneath the window dimmer is not occluded.
  13. TEST_F(WindowDimmerTest, Occlusion) {
  14. aura::Window* root_window = GetContext();
  15. aura::Window* bottom_window = aura::test::CreateTestWindow(
  16. SK_ColorWHITE, 1, root_window->bounds(), root_window);
  17. bottom_window->TrackOcclusionState();
  18. WindowDimmer dimmer(root_window);
  19. EXPECT_EQ(aura::Window::OcclusionState::VISIBLE,
  20. bottom_window->GetOcclusionState());
  21. // Sanity check: An opaque window on top of |bottom_window| occludes it.
  22. aura::test::CreateTestWindow(SK_ColorWHITE, 2, root_window->bounds(),
  23. root_window);
  24. EXPECT_EQ(aura::Window::OcclusionState::OCCLUDED,
  25. bottom_window->GetOcclusionState());
  26. }
  27. } // namespace ash