| 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 "apps/ui/native_app_window.h" | 5 #include "apps/ui/native_app_window.h" |
| 6 #include "chrome/browser/apps/app_browsertest_util.h" | 6 #include "chrome/browser/apps/app_browsertest_util.h" |
| 7 | 7 |
| 8 using extensions::Extension; | 8 using extensions::Extension; |
| 9 | 9 |
| 10 namespace apps { | 10 namespace apps { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 typedef extensions::PlatformAppBrowserTest AppWindowBrowserTest; | 14 typedef extensions::PlatformAppBrowserTest AppWindowBrowserTest; |
| 15 | 15 |
| 16 #if defined(TOOLKIT_GTK) | 16 #if defined(TOOLKIT_GTK) |
| 17 #define MAYBE_FrameInsetsForDefaultFrame DISABLED_FrameInsetsForDefaultFrame | 17 #define MAYBE_FrameInsetsForDefaultFrame DISABLED_FrameInsetsForDefaultFrame |
| 18 #else | 18 #else |
| 19 #define MAYBE_FrameInsetsForDefaultFrame FrameInsetsForDefaultFrame | 19 #define MAYBE_FrameInsetsForDefaultFrame FrameInsetsForDefaultFrame |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly. | 22 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly. |
| 23 // See crbug.com/346115 | 23 // See http://crbug.com/346115 |
| 24 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForDefaultFrame) { | 24 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForDefaultFrame) { |
| 25 AppWindow* app_window = CreateTestAppWindow("{}"); | 25 AppWindow* app_window = CreateTestAppWindow("{}"); |
| 26 NativeAppWindow* native_window = app_window->GetBaseWindow(); | 26 NativeAppWindow* native_window = app_window->GetBaseWindow(); |
| 27 gfx::Insets insets = native_window->GetFrameInsets(); | 27 gfx::Insets insets = native_window->GetFrameInsets(); |
| 28 | 28 |
| 29 // It is a reasonable assumption that the top padding must be greater than | 29 // It is a reasonable assumption that the top padding must be greater than |
| 30 // the bottom padding due to the title bar. | 30 // the bottom padding due to the title bar. |
| 31 EXPECT_TRUE(insets.top() > insets.bottom()); | 31 EXPECT_GT(insets.top(), insets.bottom()); |
| 32 | 32 |
| 33 CloseAppWindow(app_window); | 33 CloseAppWindow(app_window); |
| 34 } | 34 } |
| 35 | 35 |
| 36 #if defined(TOOLKIT_GTK) | 36 #if defined(TOOLKIT_GTK) |
| 37 #define MAYBE_FrameInsetsForColoredFrame DISABLED_FrameInsetsForColoredFrame | 37 #define MAYBE_FrameInsetsForColoredFrame DISABLED_FrameInsetsForColoredFrame |
| 38 #else | 38 #else |
| 39 #define MAYBE_FrameInsetsForColoredFrame FrameInsetsForColoredFrame | 39 #define MAYBE_FrameInsetsForColoredFrame FrameInsetsForColoredFrame |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly. | 42 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly. |
| 43 // See crbug.com/346115 | 43 // See http://crbug.com/346115 |
| 44 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForColoredFrame) { | 44 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, MAYBE_FrameInsetsForColoredFrame) { |
| 45 AppWindow* app_window = | 45 AppWindow* app_window = |
| 46 CreateTestAppWindow("{ \"frame\": { \"color\": \"#ffffff\" } }"); | 46 CreateTestAppWindow("{ \"frame\": { \"color\": \"#ffffff\" } }"); |
| 47 NativeAppWindow* native_window = app_window->GetBaseWindow(); | 47 NativeAppWindow* native_window = app_window->GetBaseWindow(); |
| 48 gfx::Insets insets = native_window->GetFrameInsets(); | 48 gfx::Insets insets = native_window->GetFrameInsets(); |
| 49 | 49 |
| 50 // It is a reasonable assumption that the top padding must be greater than | 50 // It is a reasonable assumption that the top padding must be greater than |
| 51 // the bottom padding due to the title bar. | 51 // the bottom padding due to the title bar. |
| 52 EXPECT_TRUE(insets.top() > insets.bottom()); | 52 EXPECT_GT(insets.top(), insets.bottom()); |
| 53 | 53 |
| 54 CloseAppWindow(app_window); | 54 CloseAppWindow(app_window); |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly for | 57 // Verifies that the NativeAppWindows implement GetFrameInsets() correctly for |
| 58 // frameless windows. | 58 // frameless windows. |
| 59 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, FrameInsetsForNoFrame) { | 59 IN_PROC_BROWSER_TEST_F(AppWindowBrowserTest, FrameInsetsForNoFrame) { |
| 60 AppWindow* app_window = CreateTestAppWindow("{ \"frame\": \"none\" }"); | 60 AppWindow* app_window = CreateTestAppWindow("{ \"frame\": \"none\" }"); |
| 61 NativeAppWindow* native_window = app_window->GetBaseWindow(); | 61 NativeAppWindow* native_window = app_window->GetBaseWindow(); |
| 62 gfx::Insets insets = native_window->GetFrameInsets(); | 62 gfx::Insets insets = native_window->GetFrameInsets(); |
| 63 | 63 |
| 64 // All insets must be zero. | 64 // All insets must be zero. |
| 65 EXPECT_EQ(0, insets.top()); | 65 EXPECT_EQ(0, insets.top()); |
| 66 EXPECT_EQ(0, insets.bottom()); | 66 EXPECT_EQ(0, insets.bottom()); |
| 67 EXPECT_EQ(0, insets.left()); | 67 EXPECT_EQ(0, insets.left()); |
| 68 EXPECT_EQ(0, insets.right()); | 68 EXPECT_EQ(0, insets.right()); |
| 69 | 69 |
| 70 CloseAppWindow(app_window); | 70 CloseAppWindow(app_window); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace | 73 } // namespace |
| 74 | 74 |
| 75 } // namespace apps | 75 } // namespace apps |
| OLD | NEW |