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

Unified Diff: ash/frame/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
« no previous file with comments | « ash/frame/default_header_painter.cc ('k') | ash/frame/frame_border_hit_test_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/frame/default_header_painter_unittest.cc
diff --git a/ash/frame/default_header_painter_unittest.cc b/ash/frame/default_header_painter_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4425baa56c94590c70a857e5fa1c398afc2f5d1a
--- /dev/null
+++ b/ash/frame/default_header_painter_unittest.cc
@@ -0,0 +1,57 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/frame/default_header_painter.h"
+
+#include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
+#include "ash/shell.h"
+#include "ash/test/ash_test_base.h"
+#include "ash/wm/window_state.h"
+#include "base/memory/scoped_ptr.h"
+#include "grit/ash_resources.h"
+#include "ui/gfx/font_list.h"
+#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 DefaultHeaderPainterTest : public ash::test::AshTestBase {
+ public:
+ // Creates a test widget that owns its native widget.
+ Widget* CreateTestWidget() {
+ Widget* widget = new Widget;
+ Widget::InitParams params;
+ params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ params.context = CurrentContext();
+ widget->Init(params);
+ return widget;
+ }
+};
+
+// Ensure the title text is vertically aligned with the window icon.
+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();
+
+ 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(),
+ title_bounds.CenterPoint().y());
+}
+
+} // namespace ash
« no previous file with comments | « ash/frame/default_header_painter.cc ('k') | ash/frame/frame_border_hit_test_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698