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
3 // found in the LICENSE file.
5 #include "apps/ui/native_app_window.h"
6 #include "chrome/browser/apps/app_browsertest_util.h"
8 using extensions::Extension
;
14 typedef extensions::PlatformAppBrowserTest AppWindowBrowserTest
;
16 #if defined(TOOLKIT_GTK)
17 #define MAYBE_FrameInsetsForDefaultFrame DISABLED_FrameInsetsForDefaultFrame
19 #define MAYBE_FrameInsetsForDefaultFrame FrameInsetsForDefaultFrame
22 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly.
23 // See crbug.com/346115
24 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest
, MAYBE_FrameInsetsForDefaultFrame
) {
25 AppWindow
* app_window
= CreateTestAppWindow("{}");
26 NativeAppWindow
* native_window
= app_window
->GetBaseWindow();
27 gfx::Insets insets
= native_window
->GetFrameInsets();
29 // It is a reasonable assumption that the top padding must be greater than
30 // the bottom padding due to the title bar.
31 EXPECT_TRUE(insets
.top() > insets
.bottom());
33 CloseAppWindow(app_window
);
36 #if defined(TOOLKIT_GTK)
37 #define MAYBE_FrameInsetsForColoredFrame DISABLED_FrameInsetsForColoredFrame
39 #define MAYBE_FrameInsetsForColoredFrame FrameInsetsForColoredFrame
42 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly.
43 // See crbug.com/346115
44 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest
, MAYBE_FrameInsetsForColoredFrame
) {
45 AppWindow
* app_window
=
46 CreateTestAppWindow("{ \"frame\": { \"color\": \"#ffffff\" } }");
47 NativeAppWindow
* native_window
= app_window
->GetBaseWindow();
48 gfx::Insets insets
= native_window
->GetFrameInsets();
50 // It is a reasonable assumption that the top padding must be greater than
51 // the bottom padding due to the title bar.
52 EXPECT_TRUE(insets
.top() > insets
.bottom());
54 CloseAppWindow(app_window
);
57 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly for
59 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest
, FrameInsetsForNoFrame
) {
60 AppWindow
* app_window
= CreateTestAppWindow("{ \"frame\": \"none\" }");
61 NativeAppWindow
* native_window
= app_window
->GetBaseWindow();
62 gfx::Insets insets
= native_window
->GetFrameInsets();
64 // All insets must be zero.
65 EXPECT_EQ(0, insets
.top());
66 EXPECT_EQ(0, insets
.bottom());
67 EXPECT_EQ(0, insets
.left());
68 EXPECT_EQ(0, insets
.right());
70 CloseAppWindow(app_window
);