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/wm/custom_frame_view_ash.h" | 5 #include "ash/wm/custom_frame_view_ash.h" |
6 | 6 |
7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "grit/ash_resources.h" | 9 #include "grit/ash_resources.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); | 41 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); |
42 }; | 42 }; |
43 | 43 |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 typedef test::AshTestBase CustomFrameViewAshTest; | 46 typedef test::AshTestBase CustomFrameViewAshTest; |
47 | 47 |
48 // Test that the height of the header is correct upon initially displaying | 48 // Test that the height of the header is correct upon initially displaying |
49 // the widget. | 49 // the widget. |
50 TEST_F(CustomFrameViewAshTest, HeaderHeight) { | 50 TEST_F(CustomFrameViewAshTest, HeaderHeight) { |
James Cook
2014/03/10 17:32:30
Not for this CL but it would be nice to someday ha
| |
51 TestWidgetDelegate* delegate = new TestWidgetDelegate; | 51 TestWidgetDelegate* delegate = new TestWidgetDelegate; |
52 | 52 |
53 scoped_ptr<views::Widget> widget(new views::Widget); | 53 scoped_ptr<views::Widget> widget(new views::Widget); |
54 views::Widget::InitParams params; | 54 views::Widget::InitParams params; |
55 params.delegate = delegate; | 55 params.delegate = delegate; |
56 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 56 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
57 params.bounds = gfx::Rect(0, 0, 100, 100); | 57 params.bounds = gfx::Rect(0, 0, 100, 100); |
58 params.context = CurrentContext(); | 58 params.context = CurrentContext(); |
59 widget->Init(params); | 59 widget->Init(params); |
60 widget->Show(); | 60 widget->Show(); |
61 | 61 |
62 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 62 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
63 gfx::ImageSkia* close_button = | 63 gfx::ImageSkia* close_button = |
64 rb.GetImageSkiaNamed(IDR_AURA_WINDOW_CONTROL_BACKGROUND_H); | 64 rb.GetImageSkiaNamed(IDR_AURA_WINDOW_CONTROL_BACKGROUND_H); |
65 | 65 |
66 // |kSeparatorSize| should match |kHeaderContentSeparatorSize| in | 66 // |kSeparatorSize| should match |kHeaderContentSeparatorSize| in |
67 // header_painter.cc | 67 // default_header_painter.cc |
68 // TODO(pkotwicz): Clean this test up once the separator overlays the window | 68 // TODO(pkotwicz): Clean this test up once the separator overlays the window |
69 // controls. | 69 // controls. |
70 const int kSeparatorSize = 1; | 70 const int kSeparatorSize = 1; |
71 | 71 |
72 // The header should have enough room for the window controls and the | 72 // The header should have enough room for the window controls and the |
73 // separator line. | 73 // separator line. |
74 EXPECT_EQ(close_button->height() + kSeparatorSize, | 74 EXPECT_EQ(close_button->height() + kSeparatorSize, |
75 delegate->custom_frame_view()->GetHeaderView()->height()); | 75 delegate->custom_frame_view()->GetHeaderView()->height()); |
76 | 76 |
77 widget->Maximize(); | 77 widget->Maximize(); |
78 EXPECT_EQ(close_button->height() + kSeparatorSize, | 78 EXPECT_EQ(close_button->height() + kSeparatorSize, |
79 delegate->custom_frame_view()->GetHeaderView()->height()); | 79 delegate->custom_frame_view()->GetHeaderView()->height()); |
80 } | 80 } |
81 | 81 |
82 } // namespace ash | 82 } // namespace ash |
OLD | NEW |