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

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

Issue 2618143002: cros: Remove some OS platform ifdefs from ash (Closed)
Patch Set: rebase Created 3 years, 11 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/power_button_controller.cc ('k') | ash/wm/system_gesture_event_filter.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/common/wm/screen_dimmer.h" 5 #include "ash/common/wm/screen_dimmer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/wm/window_dimmer.h" 10 #include "ash/common/wm/window_dimmer.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 ASSERT_TRUE(!root_layer->children().empty()); 68 ASSERT_TRUE(!root_layer->children().empty());
69 EXPECT_EQ(GetDimWindowLayer(), root_layer->children().back()); 69 EXPECT_EQ(GetDimWindowLayer(), root_layer->children().back());
70 EXPECT_TRUE(GetDimWindowLayer()->visible()); 70 EXPECT_TRUE(GetDimWindowLayer()->visible());
71 EXPECT_GT(GetDimWindowLayer()->GetTargetOpacity(), 0.0f); 71 EXPECT_GT(GetDimWindowLayer()->GetTargetOpacity(), 0.0f);
72 72
73 // When we disable dimming, the layer should be removed. 73 // When we disable dimming, the layer should be removed.
74 dimmer_->SetDimming(false); 74 dimmer_->SetDimming(false);
75 ASSERT_EQ(nullptr, GetDimWindowLayer()); 75 ASSERT_EQ(nullptr, GetDimWindowLayer());
76 } 76 }
77 77
78 #if defined(OS_WIN) && !defined(USE_ASH) 78 TEST_F(ScreenDimmerTest, ResizeLayer) {
79 // TODO(msw): Times out on Windows. http://crbug.com/584038
80 #define MAYBE_ResizeLayer DISABLED_ResizeLayer
81 #else
82 #define MAYBE_ResizeLayer ResizeLayer
83 #endif
84 TEST_F(ScreenDimmerTest, MAYBE_ResizeLayer) {
85 // The dimming layer should be initially sized to cover the root window. 79 // The dimming layer should be initially sized to cover the root window.
86 dimmer_->SetDimming(true); 80 dimmer_->SetDimming(true);
87 ui::Layer* dimming_layer = GetDimWindowLayer(); 81 ui::Layer* dimming_layer = GetDimWindowLayer();
88 ASSERT_TRUE(dimming_layer != nullptr); 82 ASSERT_TRUE(dimming_layer != nullptr);
89 ui::Layer* root_layer = Shell::GetPrimaryRootWindow()->layer(); 83 ui::Layer* root_layer = Shell::GetPrimaryRootWindow()->layer();
90 EXPECT_EQ(gfx::Rect(root_layer->bounds().size()).ToString(), 84 EXPECT_EQ(gfx::Rect(root_layer->bounds().size()).ToString(),
91 dimming_layer->bounds().ToString()); 85 dimming_layer->bounds().ToString());
92 86
93 // When we resize the root window, the dimming layer should be resized to 87 // When we resize the root window, the dimming layer should be resized to
94 // match. 88 // match.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 }; 131 };
138 132
139 // This test verifies ScreenDimmer can be destroyed after the shell. The 133 // This test verifies ScreenDimmer can be destroyed after the shell. The
140 // interesting part of this test is in TearDown(), which creates a ScreenDimmer 134 // interesting part of this test is in TearDown(), which creates a ScreenDimmer
141 // that is deleted after WmShell. 135 // that is deleted after WmShell.
142 TEST_F(ScreenDimmerShellDestructionTest, DontCrashIfScreenDimmerOutlivesShell) { 136 TEST_F(ScreenDimmerShellDestructionTest, DontCrashIfScreenDimmerOutlivesShell) {
143 } 137 }
144 138
145 } // namespace test 139 } // namespace test
146 } // namespace ash 140 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/power_button_controller.cc ('k') | ash/wm/system_gesture_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698