Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / apps / app_window_browsertest.cc
bloba132a1b62ba0287081478a2e919a66aca947c063
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 using extensions::Extension;
9 using extensions::NativeAppWindow;
11 namespace apps {
13 namespace {
15 typedef extensions::PlatformAppBrowserTest AppWindowBrowserTest;
17 // This test is disabled on Linux because of the unpredictable nature of native
18 // windows. We cannot assume that the window manager will insert any title bar
19 // at all, so the test may fail on certain window managers.
20 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
21 #define MAYBE_FrameInsetsForDefaultFrame DISABLED_FrameInsetsForDefaultFrame
22 #else
23 #define MAYBE_FrameInsetsForDefaultFrame FrameInsetsForDefaultFrame
24 #endif
26 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly.
27 // See http://crbug.com/346115
28 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForDefaultFrame) {
29 AppWindow* app_window = CreateTestAppWindow("{}");
30 NativeAppWindow* native_window = app_window->GetBaseWindow();
31 gfx::Insets insets = native_window->GetFrameInsets();
33 // It is a reasonable assumption that the top padding must be greater than
34 // the bottom padding due to the title bar.
35 EXPECT_GT(insets.top(), insets.bottom());
37 CloseAppWindow(app_window);
40 // This test is also disabled on Linux because frame: color is ignored on stable
41 // and beta channels (so it can fail the same as the previous test).
42 // TODO(benwells): Re-enable on Linux after frame: color is on stable.
43 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
44 #define MAYBE_FrameInsetsForColoredFrame DISABLED_FrameInsetsForColoredFrame
45 #else
46 #define MAYBE_FrameInsetsForColoredFrame FrameInsetsForColoredFrame
47 #endif
49 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly.
50 // See http://crbug.com/346115
51 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForColoredFrame) {
52 AppWindow* app_window =
53 CreateTestAppWindow("{ \"frame\": { \"color\": \"#ffffff\" } }");
54 NativeAppWindow* native_window = app_window->GetBaseWindow();
55 gfx::Insets insets = native_window->GetFrameInsets();
57 // It is a reasonable assumption that the top padding must be greater than
58 // the bottom padding due to the title bar.
59 EXPECT_GT(insets.top(), insets.bottom());
61 CloseAppWindow(app_window);
64 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly for
65 // frameless windows.
66 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, FrameInsetsForNoFrame) {
67 AppWindow* app_window = CreateTestAppWindow("{ \"frame\": \"none\" }");
68 NativeAppWindow* native_window = app_window->GetBaseWindow();
69 gfx::Insets insets = native_window->GetFrameInsets();
71 // All insets must be zero.
72 EXPECT_EQ(0, insets.top());
73 EXPECT_EQ(0, insets.bottom());
74 EXPECT_EQ(0, insets.left());
75 EXPECT_EQ(0, insets.right());
77 CloseAppWindow(app_window);
80 } // namespace
82 } // namespace apps