OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/apps/app_browsertest_util.h" | 5 #include "chrome/browser/apps/app_browsertest_util.h" |
6 #include "extensions/browser/app_window/native_app_window.h" | 6 #include "extensions/browser/app_window/native_app_window.h" |
7 | 7 |
8 namespace extensions { | 8 namespace extensions { |
9 | 9 |
10 namespace { | 10 namespace { |
11 | 11 |
12 typedef PlatformAppBrowserTest AppWindowBrowserTest; | 12 typedef PlatformAppBrowserTest AppWindowBrowserTest; |
13 | 13 |
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 | |
22 | |
23 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly. | 14 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly. |
24 // See http://crbug.com/346115 | 15 // See http://crbug.com/346115 |
25 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForDefaultFrame) { | 16 // Note: This test assumes that the window manager adds a top title bar, and may |
| 17 // fail on window managers that do not. (This may be true for certain window |
| 18 // managers on Linux.) Since it passes on our bots, this is acceptable. |
| 19 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, FrameInsetsForDefaultFrame) { |
26 AppWindow* app_window = CreateTestAppWindow("{}"); | 20 AppWindow* app_window = CreateTestAppWindow("{}"); |
27 NativeAppWindow* native_window = app_window->GetBaseWindow(); | 21 NativeAppWindow* native_window = app_window->GetBaseWindow(); |
28 gfx::Insets insets = native_window->GetFrameInsets(); | 22 gfx::Insets insets = native_window->GetFrameInsets(); |
29 | 23 |
30 // It is a reasonable assumption that the top padding must be greater than | 24 // It is a reasonable assumption that the top padding must be greater than |
31 // the bottom padding due to the title bar. | 25 // the bottom padding due to the title bar. |
32 EXPECT_GT(insets.top(), insets.bottom()); | 26 EXPECT_GT(insets.top(), insets.bottom()); |
33 | 27 |
34 CloseAppWindow(app_window); | 28 CloseAppWindow(app_window); |
35 } | 29 } |
36 | 30 |
37 // This test is also disabled on Linux because frame: color is ignored on stable | |
38 // and beta channels (so it can fail the same as the previous test). | |
39 // TODO(benwells): Re-enable on Linux after frame: color is on stable. | |
40 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | |
41 #define MAYBE_FrameInsetsForColoredFrame DISABLED_FrameInsetsForColoredFrame | |
42 #else | |
43 #define MAYBE_FrameInsetsForColoredFrame FrameInsetsForColoredFrame | |
44 #endif | |
45 | |
46 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly. | 31 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly. |
47 // See http://crbug.com/346115 | 32 // See http://crbug.com/346115 |
48 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForColoredFrame) { | 33 // Note: This test may also fail on window managers that do not add top title |
| 34 // bars, because frame: color is ignored on stable and beta channels. |
| 35 // TODO(benwells): Remove this comment after frame: color is on stable. |
| 36 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, FrameInsetsForColoredFrame) { |
49 AppWindow* app_window = | 37 AppWindow* app_window = |
50 CreateTestAppWindow("{ \"frame\": { \"color\": \"#ffffff\" } }"); | 38 CreateTestAppWindow("{ \"frame\": { \"color\": \"#ffffff\" } }"); |
51 NativeAppWindow* native_window = app_window->GetBaseWindow(); | 39 NativeAppWindow* native_window = app_window->GetBaseWindow(); |
52 gfx::Insets insets = native_window->GetFrameInsets(); | 40 gfx::Insets insets = native_window->GetFrameInsets(); |
53 | 41 |
54 // It is a reasonable assumption that the top padding must be greater than | 42 // It is a reasonable assumption that the top padding must be greater than |
55 // the bottom padding due to the title bar. | 43 // the bottom padding due to the title bar. |
56 EXPECT_GT(insets.top(), insets.bottom()); | 44 EXPECT_GT(insets.top(), insets.bottom()); |
57 | 45 |
58 CloseAppWindow(app_window); | 46 CloseAppWindow(app_window); |
(...skipping 11 matching lines...) Expand all Loading... |
70 EXPECT_EQ(0, insets.bottom()); | 58 EXPECT_EQ(0, insets.bottom()); |
71 EXPECT_EQ(0, insets.left()); | 59 EXPECT_EQ(0, insets.left()); |
72 EXPECT_EQ(0, insets.right()); | 60 EXPECT_EQ(0, insets.right()); |
73 | 61 |
74 CloseAppWindow(app_window); | 62 CloseAppWindow(app_window); |
75 } | 63 } |
76 | 64 |
77 } // namespace | 65 } // namespace |
78 | 66 |
79 } // namespace extensions | 67 } // namespace extensions |
OLD | NEW |