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

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: for landing Created 4 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
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(
138 delegate->custom_frame_view()->GetHeaderView()->height()); 135 GetAshLayoutSize(AshLayoutSize::NON_BROWSER_CAPTION_BUTTON).height(),
136 delegate->custom_frame_view()->GetHeaderView()->height());
139 } 137 }
140 138
141 // Verify that CustomFrameViewAsh returns the correct minimum and maximum frame 139 // Verify that CustomFrameViewAsh returns the correct minimum and maximum frame
142 // sizes when the client view does not specify any size constraints. 140 // sizes when the client view does not specify any size constraints.
143 TEST_F(CustomFrameViewAshTest, NoSizeConstraints) { 141 TEST_F(CustomFrameViewAshTest, NoSizeConstraints) {
144 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate; 142 TestWidgetConstraintsDelegate* delegate = new TestWidgetConstraintsDelegate;
145 scoped_ptr<views::Widget> widget(CreateWidget(delegate)); 143 scoped_ptr<views::Widget> widget(CreateWidget(delegate));
146 144
147 CustomFrameViewAsh* custom_frame_view = delegate->custom_frame_view(); 145 CustomFrameViewAsh* custom_frame_view = delegate->custom_frame_view();
148 gfx::Size min_frame_size = custom_frame_view->GetMinimumSize(); 146 gfx::Size min_frame_size = custom_frame_view->GetMinimumSize();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); 218 EXPECT_GT(initial.width(), maximize_mode_bounds.width());
221 Shell::GetInstance()->maximize_mode_controller()-> 219 Shell::GetInstance()->maximize_mode_controller()->
222 EnableMaximizeModeWindowManager(false); 220 EnableMaximizeModeWindowManager(false);
223 delegate->EndFrameCaptionButtonContainerViewAnimations(); 221 delegate->EndFrameCaptionButtonContainerViewAnimations();
224 const gfx::Rect after_restore = delegate-> 222 const gfx::Rect after_restore = delegate->
225 GetFrameCaptionButtonContainerViewBounds(); 223 GetFrameCaptionButtonContainerViewBounds();
226 EXPECT_EQ(initial, after_restore); 224 EXPECT_EQ(initial, after_restore);
227 } 225 }
228 226
229 } // namespace ash 227 } // namespace ash
OLDNEW
« no previous file with comments | « ash/frame/caption_buttons/frame_size_button_unittest.cc ('k') | ash/frame/default_header_painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698