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

Side by Side Diff: ash/frame/custom_frame_view_ash_unittest.cc

Issue 1505223004: Do not use assets for Ash window control button backgrounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ash layout constants file added Created 5 years 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
OLDNEW
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/custom_frame_view_ash.h" 5 #include "ash/frame/custom_frame_view_ash.h"
6 6
7 #include "ash/ash_layout_constants.h"
7 #include "ash/frame/caption_buttons/frame_caption_button.h" 8 #include "ash/frame/caption_buttons/frame_caption_button.h"
8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 11 #include "ash/test/ash_test_base.h"
11 #include "ash/test/test_session_state_delegate.h" 12 #include "ash/test/test_session_state_delegate.h"
12 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 13 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "grit/ash_resources.h" 15 #include "grit/ash_resources.h"
15 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 }; 122 };
122 123
123 // Test that the height of the header is correct upon initially displaying 124 // Test that the height of the header is correct upon initially displaying
124 // the widget. 125 // the widget.
125 TEST_F(CustomFrameViewAshTest, HeaderHeight) { 126 TEST_F(CustomFrameViewAshTest, HeaderHeight) {
126 TestWidgetDelegate* delegate = new TestWidgetDelegate; 127 TestWidgetDelegate* delegate = new TestWidgetDelegate;
127 128
128 scoped_ptr<views::Widget> widget(CreateWidget(delegate)); 129 scoped_ptr<views::Widget> widget(CreateWidget(delegate));
129 widget->Show(); 130 widget->Show();
130 131
131 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
132 gfx::ImageSkia* close_button =
133 rb.GetImageSkiaNamed(IDR_AURA_WINDOW_CONTROL_BACKGROUND_H);
134
135 // The header should have enough room for the window controls. The 132 // The header should have enough room for the window controls. The
136 // header/content separator line overlays the window controls. 133 // header/content separator line overlays the window controls.
137 EXPECT_EQ(close_button->height(), 134 EXPECT_EQ(GetAshLayoutSize(DEFAULT_HEADER_BUTTON).height(),
138 delegate->custom_frame_view()->GetHeaderView()->height()); 135 delegate->custom_frame_view()->GetHeaderView()->height());
139 } 136 }
140 137
141 // Verify that CustomFrameViewAsh returns the correct minimum and maximum frame 138 // Verify that CustomFrameViewAsh returns the correct minimum and maximum frame
142 // sizes when the client view does not specify any size constraints. 139 // sizes when the client view does not specify any size constraints.
143 TEST_F(CustomFrameViewAshTest, NoSizeConstraints) { 140 TEST_F(CustomFrameViewAshTest, NoSizeConstraints) {
144 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate; 141 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate;
145 scoped_ptr<views::Widget> widget(CreateWidget(delegate)); 142 scoped_ptr<views::Widget> widget(CreateWidget(delegate));
146 143
147 CustomFrameViewAsh* custom_frame_view = delegate->custom_frame_view(); 144 CustomFrameViewAsh* custom_frame_view = delegate->custom_frame_view();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); 217 EXPECT_GT(initial.width(), maximize_mode_bounds.width());
221 Shell::GetInstance()->maximize_mode_controller()-> 218 Shell::GetInstance()->maximize_mode_controller()->
222 EnableMaximizeModeWindowManager(false); 219 EnableMaximizeModeWindowManager(false);
223 delegate->EndFrameCaptionButtonContainerViewAnimations(); 220 delegate->EndFrameCaptionButtonContainerViewAnimations();
224 const gfx::Rect after_restore = delegate-> 221 const gfx::Rect after_restore = delegate->
225 GetFrameCaptionButtonContainerViewBounds(); 222 GetFrameCaptionButtonContainerViewBounds();
226 EXPECT_EQ(initial, after_restore); 223 EXPECT_EQ(initial, after_restore);
227 } 224 }
228 225
229 } // namespace ash 226 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698