Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(732)

Side by Side Diff: ash/wm/screen_dimmer_unittest.cc

Issue 2320273002: Refactors DimWindow and moves to ash/common (Closed)
Patch Set: git add wm_window Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698