OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame/default_header_painter.h" | 5 #include "ash/frame/default_header_painter.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Ensure the title text is vertically aligned with the window icon. | 37 // Ensure the title text is vertically aligned with the window icon. |
38 TEST_F(DefaultHeaderPainterTest, TitleIconAlignment) { | 38 TEST_F(DefaultHeaderPainterTest, TitleIconAlignment) { |
39 std::unique_ptr<Widget> w(CreateTestWidget()); | 39 std::unique_ptr<Widget> w(CreateTestWidget()); |
40 ash::FrameCaptionButtonContainerView container(w.get()); | 40 ash::FrameCaptionButtonContainerView container(w.get()); |
41 views::StaticSizedView window_icon(gfx::Size(16, 16)); | 41 views::StaticSizedView window_icon(gfx::Size(16, 16)); |
42 window_icon.SetBounds(0, 0, 16, 16); | 42 window_icon.SetBounds(0, 0, 16, 16); |
43 w->SetBounds(gfx::Rect(0, 0, 500, 500)); | 43 w->SetBounds(gfx::Rect(0, 0, 500, 500)); |
44 w->Show(); | 44 w->Show(); |
45 | 45 |
46 DefaultHeaderPainter painter; | 46 DefaultHeaderPainter painter; |
47 painter.Init(w.get(), | 47 painter.Init(w.get(), w->non_client_view()->frame_view(), &container); |
48 w->non_client_view()->frame_view(), | |
49 &container); | |
50 painter.UpdateLeftHeaderView(&window_icon); | 48 painter.UpdateLeftHeaderView(&window_icon); |
51 painter.LayoutHeader(); | 49 painter.LayoutHeader(); |
52 gfx::Rect title_bounds = painter.GetTitleBounds(); | 50 gfx::Rect title_bounds = painter.GetTitleBounds(); |
53 EXPECT_EQ(window_icon.bounds().CenterPoint().y(), | 51 EXPECT_EQ(window_icon.bounds().CenterPoint().y(), |
54 title_bounds.CenterPoint().y()); | 52 title_bounds.CenterPoint().y()); |
55 } | 53 } |
56 | 54 |
57 // Ensure the light icons are used when appropriate. | 55 // Ensure the light icons are used when appropriate. |
58 TEST_F(DefaultHeaderPainterTest, LightIcons) { | 56 TEST_F(DefaultHeaderPainterTest, LightIcons) { |
59 std::unique_ptr<Widget> w(CreateTestWidget()); | 57 std::unique_ptr<Widget> w(CreateTestWidget()); |
(...skipping 29 matching lines...) Expand all Loading... |
89 // Check not so light or dark colors. | 87 // Check not so light or dark colors. |
90 painter.SetFrameColors(SkColorSetRGB(70, 70, 70), | 88 painter.SetFrameColors(SkColorSetRGB(70, 70, 70), |
91 SkColorSetRGB(200, 200, 200)); | 89 SkColorSetRGB(200, 200, 200)); |
92 painter.mode_ = HeaderPainter::MODE_ACTIVE; | 90 painter.mode_ = HeaderPainter::MODE_ACTIVE; |
93 EXPECT_TRUE(painter.ShouldUseLightImages()); | 91 EXPECT_TRUE(painter.ShouldUseLightImages()); |
94 painter.mode_ = HeaderPainter::MODE_INACTIVE; | 92 painter.mode_ = HeaderPainter::MODE_INACTIVE; |
95 EXPECT_FALSE(painter.ShouldUseLightImages()); | 93 EXPECT_FALSE(painter.ShouldUseLightImages()); |
96 } | 94 } |
97 | 95 |
98 } // namespace ash | 96 } // namespace ash |
OLD | NEW |