| 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/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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 dimmer_->SetDimming(true); | 86 dimmer_->SetDimming(true); |
| 87 ui::Layer* dimming_layer = GetDimWindowLayer(); | 87 ui::Layer* dimming_layer = GetDimWindowLayer(); |
| 88 ASSERT_TRUE(dimming_layer != nullptr); | 88 ASSERT_TRUE(dimming_layer != nullptr); |
| 89 ui::Layer* root_layer = Shell::GetPrimaryRootWindow()->layer(); | 89 ui::Layer* root_layer = Shell::GetPrimaryRootWindow()->layer(); |
| 90 EXPECT_EQ(gfx::Rect(root_layer->bounds().size()).ToString(), | 90 EXPECT_EQ(gfx::Rect(root_layer->bounds().size()).ToString(), |
| 91 dimming_layer->bounds().ToString()); | 91 dimming_layer->bounds().ToString()); |
| 92 | 92 |
| 93 // When we resize the root window, the dimming layer should be resized to | 93 // When we resize the root window, the dimming layer should be resized to |
| 94 // match. | 94 // match. |
| 95 gfx::Rect kNewBounds(400, 300); | 95 gfx::Rect kNewBounds(400, 300); |
| 96 Shell::GetPrimaryRootWindow()->GetHost()->SetBounds(kNewBounds); | 96 Shell::GetPrimaryRootWindow()->GetHost()->SetBoundsInPixels(kNewBounds); |
| 97 EXPECT_EQ(kNewBounds.ToString(), dimming_layer->bounds().ToString()); | 97 EXPECT_EQ(kNewBounds.ToString(), dimming_layer->bounds().ToString()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 TEST_F(ScreenDimmerTest, DimAtBottom) { | 100 TEST_F(ScreenDimmerTest, DimAtBottom) { |
| 101 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 101 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
| 102 std::unique_ptr<aura::Window> window( | 102 std::unique_ptr<aura::Window> window( |
| 103 aura::test::CreateTestWindowWithId(1, root_window)); | 103 aura::test::CreateTestWindowWithId(1, root_window)); |
| 104 dimmer_->SetDimming(true); | 104 dimmer_->SetDimming(true); |
| 105 std::vector<aura::Window*>::const_iterator dim_iter = | 105 std::vector<aura::Window*>::const_iterator dim_iter = |
| 106 std::find(root_window->children().begin(), root_window->children().end(), | 106 std::find(root_window->children().begin(), root_window->children().end(), |
| (...skipping 30 matching lines...) Expand all Loading... |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 // This test verifies ScreenDimmer can be destroyed after the shell. The | 139 // This test verifies ScreenDimmer can be destroyed after the shell. The |
| 140 // interesting part of this test is in TearDown(), which creates a ScreenDimmer | 140 // interesting part of this test is in TearDown(), which creates a ScreenDimmer |
| 141 // that is deleted after WmShell. | 141 // that is deleted after WmShell. |
| 142 TEST_F(ScreenDimmerShellDestructionTest, DontCrashIfScreenDimmerOutlivesShell) { | 142 TEST_F(ScreenDimmerShellDestructionTest, DontCrashIfScreenDimmerOutlivesShell) { |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace test | 145 } // namespace test |
| 146 } // namespace ash | 146 } // namespace ash |
| OLD | NEW |