Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / browser / app_window / app_window_browsertest.cc
blob784c9b1796285099f490594b93db314016f8e6e7
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 "chrome/browser/apps/app_browsertest_util.h"
6 #include "extensions/browser/app_window/native_app_window.h"
8 namespace extensions {
10 namespace {
12 typedef PlatformAppBrowserTest AppWindowBrowserTest;
14 // This test is disabled on Linux because of the unpredictable nature of native
15 // windows. We cannot assume that the window manager will insert any title bar
16 // at all, so the test may fail on certain window managers.
17 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
18 #define MAYBE_FrameInsetsForDefaultFrame DISABLED_FrameInsetsForDefaultFrame
19 #else
20 #define MAYBE_FrameInsetsForDefaultFrame FrameInsetsForDefaultFrame
21 #endif
23 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly.
24 // See http://crbug.com/346115
25 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForDefaultFrame) {
26 AppWindow* app_window = CreateTestAppWindow("{}");
27 NativeAppWindow* native_window = app_window->GetBaseWindow();
28 gfx::Insets insets = native_window->GetFrameInsets();
30 // It is a reasonable assumption that the top padding must be greater than
31 // the bottom padding due to the title bar.
32 EXPECT_GT(insets.top(), insets.bottom());
34 CloseAppWindow(app_window);
37 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly.
38 // See http://crbug.com/346115
39 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, FrameInsetsForColoredFrame) {
40 AppWindow* app_window =
41 CreateTestAppWindow("{ \"frame\": { \"color\": \"#ffffff\" } }");
42 NativeAppWindow* native_window = app_window->GetBaseWindow();
43 gfx::Insets insets = native_window->GetFrameInsets();
45 // It is a reasonable assumption that the top padding must be greater than
46 // the bottom padding due to the title bar.
47 EXPECT_GT(insets.top(), insets.bottom());
49 CloseAppWindow(app_window);
52 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly for
53 // frameless windows.
54 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, FrameInsetsForNoFrame) {
55 AppWindow* app_window = CreateTestAppWindow("{ \"frame\": \"none\" }");
56 NativeAppWindow* native_window = app_window->GetBaseWindow();
57 gfx::Insets insets = native_window->GetFrameInsets();
59 // All insets must be zero.
60 EXPECT_EQ(0, insets.top());
61 EXPECT_EQ(0, insets.bottom());
62 EXPECT_EQ(0, insets.left());
63 EXPECT_EQ(0, insets.right());
65 CloseAppWindow(app_window);
68 } // namespace
70 } // namespace extensions