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

Unified Diff: ash/wm/default_header_painter_unittest.cc

Issue 189463013: [Refactor] Move code for painting the window header for browser windows out of ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/default_header_painter_unittest.cc
diff --git a/ash/wm/default_header_painter_unittest.cc b/ash/wm/default_header_painter_unittest.cc
index 6156214866aafbbff1aafef26111d87874d3099e..55c2ed77c6c249850d7a1fd1e6967757f2452ccf 100644
--- a/ash/wm/default_header_painter_unittest.cc
+++ b/ash/wm/default_header_painter_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/wm/header_painter.h"
+#include "ash/wm/default_header_painter.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
@@ -14,13 +14,11 @@
#include "ui/views/widget/widget.h"
#include "ui/views/window/non_client_view.h"
-using ash::HeaderPainter;
-using views::NonClientFrameView;
using views::Widget;
namespace ash {
-class HeaderPainterTest : public ash::test::AshTestBase {
+class DefaultHeaderPainterTest : public ash::test::AshTestBase {
public:
// Creates a test widget that owns its native widget.
Widget* CreateTestWidget() {
@@ -34,50 +32,23 @@ class HeaderPainterTest : public ash::test::AshTestBase {
};
// Ensure the title text is vertically aligned with the window icon.
-TEST_F(HeaderPainterTest, TitleIconAlignment) {
+TEST_F(DefaultHeaderPainterTest, TitleIconAlignment) {
scoped_ptr<Widget> w(CreateTestWidget());
ash::FrameCaptionButtonContainerView container(w.get(),
ash::FrameCaptionButtonContainerView::MINIMIZE_ALLOWED);
views::View window_icon;
- window_icon.SetBounds(0, 0, 16, 16);
w->SetBounds(gfx::Rect(0, 0, 500, 500));
w->Show();
- gfx::FontList default_font_list;
-
- // 1) Non-browser windows.
- HeaderPainter non_browser_painter;
- non_browser_painter.Init(HeaderPainter::STYLE_OTHER,
- w.get(),
- w->non_client_view()->frame_view(),
- &window_icon,
- &container);
- non_browser_painter.LayoutHeader();
- gfx::Rect non_browser_header_title_bounds =
- non_browser_painter.GetTitleBounds(default_font_list);
- EXPECT_EQ(window_icon.bounds().CenterPoint().y(),
- non_browser_header_title_bounds.CenterPoint().y());
-
- // 2) Non-maximized browser windows.
- HeaderPainter browser_painter;
- browser_painter.Init(HeaderPainter::STYLE_BROWSER,
- w.get(),
- w->non_client_view()->frame_view(),
- &window_icon,
- &container);
- browser_painter.LayoutHeader();
- gfx::Rect browser_header_title_bounds =
- browser_painter.GetTitleBounds(default_font_list);
- EXPECT_EQ(window_icon.bounds().CenterPoint().y(),
- browser_header_title_bounds.CenterPoint().y());
-
- // 3) Maximized browser windows.
- w->Maximize();
- browser_painter.LayoutHeader();
- gfx::Rect maximized_browser_header_title_bounds =
- browser_painter.GetTitleBounds(default_font_list);
+ DefaultHeaderPainter painter;
+ painter.Init(w.get(),
+ w->non_client_view()->frame_view(),
+ &window_icon,
+ &container);
+ painter.LayoutHeader();
+ gfx::Rect title_bounds = painter.GetTitleBounds();
EXPECT_EQ(window_icon.bounds().CenterPoint().y(),
- maximized_browser_header_title_bounds.CenterPoint().y());
+ title_bounds.CenterPoint().y());
}
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698