Files.app: Override overflow specifying to use the original scroll bar.
[chromium-blink-merge.git] / apps / app_window_browsertest.cc
blob22446a3656ee753998efb6a67363f5ea7fdd3e68
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;
10 namespace apps {
12 namespace {
14 typedef extensions::PlatformAppBrowserTest AppWindowBrowserTest;
16 // This test is disabled on Linux because of the unpredictable nature of native
17 // windows. We cannot assume that the window manager will insert any title bar
18 // at all, so the test may fail on certain window managers.
19 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
20 #define MAYBE_FrameInsetsForDefaultFrame DISABLED_FrameInsetsForDefaultFrame
21 #else
22 #define MAYBE_FrameInsetsForDefaultFrame FrameInsetsForDefaultFrame
23 #endif
25 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly.
26 // See http://crbug.com/346115
27 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForDefaultFrame) {
28 AppWindow* app_window = CreateTestAppWindow("{}");
29 NativeAppWindow* native_window = app_window->GetBaseWindow();
30 gfx::Insets insets = native_window->GetFrameInsets();
32 // It is a reasonable assumption that the top padding must be greater than
33 // the bottom padding due to the title bar.
34 EXPECT_GT(insets.top(), insets.bottom());
36 CloseAppWindow(app_window);
39 // This test is also disabled on Linux because frame: color is ignored on stable
40 // and beta channels (so it can fail the same as the previous test).
41 // TODO(benwells): Re-enable on Linux after frame: color is on stable.
42 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
43 #define MAYBE_FrameInsetsForColoredFrame DISABLED_FrameInsetsForColoredFrame
44 #else
45 #define MAYBE_FrameInsetsForColoredFrame FrameInsetsForColoredFrame
46 #endif
48 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly.
49 // See http://crbug.com/346115
50 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForColoredFrame) {
51 AppWindow* app_window =
52 CreateTestAppWindow("{ \"frame\": { \"color\": \"#ffffff\" } }");
53 NativeAppWindow* native_window = app_window->GetBaseWindow();
54 gfx::Insets insets = native_window->GetFrameInsets();
56 // It is a reasonable assumption that the top padding must be greater than
57 // the bottom padding due to the title bar.
58 EXPECT_GT(insets.top(), insets.bottom());
60 CloseAppWindow(app_window);
63 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly for
64 // frameless windows.
65 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, FrameInsetsForNoFrame) {
66 AppWindow* app_window = CreateTestAppWindow("{ \"frame\": \"none\" }");
67 NativeAppWindow* native_window = app_window->GetBaseWindow();
68 gfx::Insets insets = native_window->GetFrameInsets();
70 // All insets must be zero.
71 EXPECT_EQ(0, insets.top());
72 EXPECT_EQ(0, insets.bottom());
73 EXPECT_EQ(0, insets.left());
74 EXPECT_EQ(0, insets.right());
76 CloseAppWindow(app_window);
79 } // namespace
81 } // namespace apps