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

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

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 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
« no previous file with comments | « ash/wm/screen_dimmer.h ('k') | ash/wm/session_state_animator_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
8
7 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
8 #include "ash/shell.h" 10 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 11 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/dim_window.h" 12 #include "ash/wm/dim_window.h"
11 #include "base/memory/scoped_ptr.h"
12 //#include "ui/aura/window_event_dispatcher.h" 13 //#include "ui/aura/window_event_dispatcher.h"
13 #include "ui/aura/test/test_windows.h" 14 #include "ui/aura/test/test_windows.h"
14 #include "ui/compositor/layer.h" 15 #include "ui/compositor/layer.h"
15 16
16 namespace ash { 17 namespace ash {
17 namespace test { 18 namespace test {
18 19
19 class ScreenDimmerTest : public AshTestBase { 20 class ScreenDimmerTest : public AshTestBase {
20 public: 21 public:
21 ScreenDimmerTest() : dimmer_(nullptr) {} 22 ScreenDimmerTest() : dimmer_(nullptr) {}
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 TEST_F(ScreenDimmerTest, RootDimmer) { 89 TEST_F(ScreenDimmerTest, RootDimmer) {
89 ScreenDimmer* root_dimmer = ScreenDimmer::GetForRoot(); 90 ScreenDimmer* root_dimmer = ScreenDimmer::GetForRoot();
90 // -100 is the magic number for root window. 91 // -100 is the magic number for root window.
91 EXPECT_EQ(root_dimmer, ScreenDimmer::FindForTest(-100)); 92 EXPECT_EQ(root_dimmer, ScreenDimmer::FindForTest(-100));
92 EXPECT_EQ(nullptr, ScreenDimmer::FindForTest(-1)); 93 EXPECT_EQ(nullptr, ScreenDimmer::FindForTest(-1));
93 } 94 }
94 95
95 TEST_F(ScreenDimmerTest, DimAtBottom) { 96 TEST_F(ScreenDimmerTest, DimAtBottom) {
96 ScreenDimmer* root_dimmer = ScreenDimmer::GetForRoot(); 97 ScreenDimmer* root_dimmer = ScreenDimmer::GetForRoot();
97 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 98 aura::Window* root_window = Shell::GetPrimaryRootWindow();
98 scoped_ptr<aura::Window> window( 99 std::unique_ptr<aura::Window> window(
99 aura::test::CreateTestWindowWithId(1, root_window)); 100 aura::test::CreateTestWindowWithId(1, root_window));
100 root_dimmer->SetDimming(true); 101 root_dimmer->SetDimming(true);
101 std::vector<aura::Window*>::const_iterator dim_iter = 102 std::vector<aura::Window*>::const_iterator dim_iter =
102 std::find(root_window->children().begin(), root_window->children().end(), 103 std::find(root_window->children().begin(), root_window->children().end(),
103 GetDimWindow()); 104 GetDimWindow());
104 ASSERT_TRUE(dim_iter != root_window->children().end()); 105 ASSERT_TRUE(dim_iter != root_window->children().end());
105 // Dim layer is at top. 106 // Dim layer is at top.
106 EXPECT_EQ(*dim_iter, *root_window->children().rbegin()); 107 EXPECT_EQ(*dim_iter, *root_window->children().rbegin());
107 108
108 root_dimmer->SetDimming(false); 109 root_dimmer->SetDimming(false);
109 root_dimmer->set_at_bottom(true); 110 root_dimmer->set_at_bottom(true);
110 root_dimmer->SetDimming(true); 111 root_dimmer->SetDimming(true);
111 112
112 dim_iter = std::find(root_window->children().begin(), 113 dim_iter = std::find(root_window->children().begin(),
113 root_window->children().end(), GetDimWindow()); 114 root_window->children().end(), GetDimWindow());
114 ASSERT_TRUE(dim_iter != root_window->children().end()); 115 ASSERT_TRUE(dim_iter != root_window->children().end());
115 // Dom layer is at the bottom. 116 // Dom layer is at the bottom.
116 EXPECT_EQ(*dim_iter, *root_window->children().begin()); 117 EXPECT_EQ(*dim_iter, *root_window->children().begin());
117 } 118 }
118 119
119 } // namespace test 120 } // namespace test
120 } // namespace ash 121 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/screen_dimmer.h ('k') | ash/wm/session_state_animator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698