| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/screen_dimmer.h" | 5 #include "ash/wm/screen_dimmer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/wm/window_dimmer.h" |
| 9 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
| 10 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 11 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/wm/dim_window.h" | |
| 13 //#include "ui/aura/window_event_dispatcher.h" | |
| 14 #include "ui/aura/test/test_windows.h" | 14 #include "ui/aura/test/test_windows.h" |
| 15 #include "ui/compositor/layer.h" | 15 #include "ui/compositor/layer.h" |
| 16 | 16 |
| 17 namespace ash { | 17 namespace ash { |
| 18 namespace test { | 18 namespace test { |
| 19 | 19 |
| 20 class ScreenDimmerTest : public AshTestBase { | 20 class ScreenDimmerTest : public AshTestBase { |
| 21 public: | 21 public: |
| 22 ScreenDimmerTest() : dimmer_(nullptr) {} | 22 ScreenDimmerTest() : dimmer_(nullptr) {} |
| 23 ~ScreenDimmerTest() override {} | 23 ~ScreenDimmerTest() override {} |
| 24 | 24 |
| 25 void SetUp() override { | 25 void SetUp() override { |
| 26 AshTestBase::SetUp(); | 26 AshTestBase::SetUp(); |
| 27 dimmer_ = ScreenDimmer::GetForRoot(); | 27 dimmer_ = ScreenDimmer::GetForRoot(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 aura::Window* GetDimWindow() { | 30 aura::Window* GetDimWindow() { |
| 31 return DimWindow::Get(Shell::GetPrimaryRootWindow()); | 31 WindowDimmer* window_dimmer = |
| 32 WindowDimmer::Get(WmWindowAura::Get(Shell::GetPrimaryRootWindow())); |
| 33 return window_dimmer ? WmWindowAura::GetAuraWindow(window_dimmer->window()) |
| 34 : nullptr; |
| 32 } | 35 } |
| 33 | 36 |
| 34 ui::Layer* GetDimWindowLayer() { | 37 ui::Layer* GetDimWindowLayer() { |
| 35 aura::Window* window = GetDimWindow(); | 38 aura::Window* window = GetDimWindow(); |
| 36 return window ? window->layer() : nullptr; | 39 return window ? window->layer() : nullptr; |
| 37 } | 40 } |
| 38 | 41 |
| 39 protected: | 42 protected: |
| 40 ScreenDimmer* dimmer_; // not owned | 43 ScreenDimmer* dimmer_; // not owned |
| 41 | 44 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 115 |
| 113 dim_iter = std::find(root_window->children().begin(), | 116 dim_iter = std::find(root_window->children().begin(), |
| 114 root_window->children().end(), GetDimWindow()); | 117 root_window->children().end(), GetDimWindow()); |
| 115 ASSERT_TRUE(dim_iter != root_window->children().end()); | 118 ASSERT_TRUE(dim_iter != root_window->children().end()); |
| 116 // Dom layer is at the bottom. | 119 // Dom layer is at the bottom. |
| 117 EXPECT_EQ(*dim_iter, *root_window->children().begin()); | 120 EXPECT_EQ(*dim_iter, *root_window->children().begin()); |
| 118 } | 121 } |
| 119 | 122 |
| 120 } // namespace test | 123 } // namespace test |
| 121 } // namespace ash | 124 } // namespace ash |
| OLD | NEW |