| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "chrome/browser/apps/app_browsertest_util.h" | |
| 6 #include "extensions/browser/app_window/native_app_window.h" | |
| 7 | |
| 8 using extensions::Extension; | |
| 9 using extensions::NativeAppWindow; | |
| 10 | |
| 11 namespace apps { | |
| 12 | |
| 13 namespace { | |
| 14 | |
| 15 typedef extensions::PlatformAppBrowserTest AppWindowBrowserTest; | |
| 16 | |
| 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 | |
| 25 | |
| 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(); | |
| 32 | |
| 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()); | |
| 36 | |
| 37 CloseAppWindow(app_window); | |
| 38 } | |
| 39 | |
| 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 | |
| 48 | |
| 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(); | |
| 56 | |
| 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()); | |
| 60 | |
| 61 CloseAppWindow(app_window); | |
| 62 } | |
| 63 | |
| 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(); | |
| 70 | |
| 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()); | |
| 76 | |
| 77 CloseAppWindow(app_window); | |
| 78 } | |
| 79 | |
| 80 } // namespace | |
| 81 | |
| 82 } // namespace apps | |
| OLD | NEW |