Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <memory> | 6 #include <memory> |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 3844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3855 #endif | 3855 #endif |
| 3856 Widget widget; | 3856 Widget widget; |
| 3857 InitializeWidgetForOpacity(widget, CreateParams(widget_type), opacity); | 3857 InitializeWidgetForOpacity(widget, CreateParams(widget_type), opacity); |
| 3858 | 3858 |
| 3859 // Use NativeWidgetAura directly. | 3859 // Use NativeWidgetAura directly. |
| 3860 if (IsMus() && | 3860 if (IsMus() && |
| 3861 (widget_type == Widget::InitParams::TYPE_WINDOW_FRAMELESS || | 3861 (widget_type == Widget::InitParams::TYPE_WINDOW_FRAMELESS || |
| 3862 widget_type == Widget::InitParams::TYPE_CONTROL)) | 3862 widget_type == Widget::InitParams::TYPE_CONTROL)) |
| 3863 continue; | 3863 continue; |
| 3864 | 3864 |
| 3865 #if defined(OS_MACOSX) | |
| 3866 // Mac always always has a compositing window manager, but doesn't have | |
| 3867 // transparent titlebars which is what ShouldWindowContentsBeTransparent() | |
| 3868 // is currently used for. Asking for transparency should get it. Note that | |
| 3869 // TestViewsDelegate::use_transparent_windows_ determines the result of | |
| 3870 // INFER_OPACITY: assume it is false. | |
| 3871 bool should_be_transparent = | |
| 3872 opacity == Widget::InitParams::TRANSLUCENT_WINDOW; | |
| 3873 #else | |
| 3874 bool should_be_transparent = widget.ShouldWindowContentsBeTransparent(); | |
| 3875 #endif | |
| 3876 | |
| 3865 EXPECT_EQ(IsNativeWindowTransparent(widget.GetNativeWindow()), | 3877 EXPECT_EQ(IsNativeWindowTransparent(widget.GetNativeWindow()), |
| 3866 widget.ShouldWindowContentsBeTransparent()); | 3878 should_be_transparent); |
|
sadrul
2016/12/07 18:03:35
Should NativeWidgetMac::ShouldWindowContentsBeTran
tapted
2016/12/07 23:35:52
Yeah I thought about it, but I think NativeWidgetM
| |
| 3867 | 3879 |
| 3868 // When using the Mandoline UI Service, the translucency does not rely on | 3880 // When using the Mandoline UI Service, the translucency does not rely on |
| 3869 // the widget type. | 3881 // the widget type. |
| 3870 if (IsMus()) | 3882 if (IsMus()) |
| 3871 continue; | 3883 continue; |
| 3872 | 3884 |
| 3873 #if defined(USE_X11) | 3885 #if defined(USE_X11) |
| 3874 if (HasCompositingManager() && | 3886 if (HasCompositingManager() && |
| 3875 (widget_type == Widget::InitParams::TYPE_DRAG || | 3887 (widget_type == Widget::InitParams::TYPE_DRAG || |
| 3876 widget_type == Widget::InitParams::TYPE_WINDOW)) { | 3888 widget_type == Widget::InitParams::TYPE_WINDOW)) { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 3892 | 3904 |
| 3893 // Test opacity when compositing is enabled. | 3905 // Test opacity when compositing is enabled. |
| 3894 TEST_F(CompositingWidgetTest, Transparency_DesktopWidgetInferOpacity) { | 3906 TEST_F(CompositingWidgetTest, Transparency_DesktopWidgetInferOpacity) { |
| 3895 CheckAllWidgetsForOpacity(Widget::InitParams::INFER_OPACITY); | 3907 CheckAllWidgetsForOpacity(Widget::InitParams::INFER_OPACITY); |
| 3896 } | 3908 } |
| 3897 | 3909 |
| 3898 TEST_F(CompositingWidgetTest, Transparency_DesktopWidgetOpaque) { | 3910 TEST_F(CompositingWidgetTest, Transparency_DesktopWidgetOpaque) { |
| 3899 CheckAllWidgetsForOpacity(Widget::InitParams::OPAQUE_WINDOW); | 3911 CheckAllWidgetsForOpacity(Widget::InitParams::OPAQUE_WINDOW); |
| 3900 } | 3912 } |
| 3901 | 3913 |
| 3902 // Failing on Mac. http://cbrug.com/623421 | 3914 TEST_F(CompositingWidgetTest, Transparency_DesktopWidgetTranslucent) { |
| 3903 #if defined(OS_MACOSX) | |
| 3904 #define MAYBE_Transparency_DesktopWidgetTranslucent \ | |
| 3905 DISABLED_Transparency_DesktopWidgetTranslucent | |
| 3906 #else | |
| 3907 #define MAYBE_Transparency_DesktopWidgetTranslucent \ | |
| 3908 Transparency_DesktopWidgetTranslucent | |
| 3909 #endif | |
| 3910 TEST_F(CompositingWidgetTest, MAYBE_Transparency_DesktopWidgetTranslucent) { | |
| 3911 CheckAllWidgetsForOpacity(Widget::InitParams::TRANSLUCENT_WINDOW); | 3915 CheckAllWidgetsForOpacity(Widget::InitParams::TRANSLUCENT_WINDOW); |
| 3912 } | 3916 } |
| 3913 | 3917 |
| 3914 #endif // !defined(OS_CHROMEOS) | 3918 #endif // !defined(OS_CHROMEOS) |
| 3915 | 3919 |
| 3916 } // namespace test | 3920 } // namespace test |
| 3917 } // namespace views | 3921 } // namespace views |
| OLD | NEW |