Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: ui/views/widget/widget_unittest.cc

Issue 2124633002: Add new gpu driver bug workaround DISABLE_TRANSPARENT_VISUALS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: check for _CHROMIUM_INSIDE_XVFB var to relax unit test Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/command_line.h" 10 #include "base/environment.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/base/hit_test.h" 17 #include "ui/base/hit_test.h"
18 #include "ui/compositor/layer_animation_observer.h" 18 #include "ui/compositor/layer_animation_observer.h"
19 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 19 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
20 #include "ui/compositor/scoped_layer_animation_settings.h" 20 #include "ui/compositor/scoped_layer_animation_settings.h"
(...skipping 3716 matching lines...) Expand 10 before | Expand all | Expand 10 after
3737 3737
3738 #if !defined(OS_CHROMEOS) 3738 #if !defined(OS_CHROMEOS)
3739 3739
3740 namespace { 3740 namespace {
3741 3741
3742 void InitializeWidgetForOpacity( 3742 void InitializeWidgetForOpacity(
3743 Widget& widget, 3743 Widget& widget,
3744 Widget::InitParams init_params, 3744 Widget::InitParams init_params,
3745 const Widget::InitParams::WindowOpacity opacity) { 3745 const Widget::InitParams::WindowOpacity opacity) {
3746 #if defined(USE_X11) 3746 #if defined(USE_X11)
3747 // On Linux, transparent visuals is currently not activated by default. 3747 // testing/xvfb.py runs xvfb and xcompmgr.
3748 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 3748 std::unique_ptr<base::Environment> env(base::Environment::Create());
3749 command_line->AppendSwitch(switches::kEnableTransparentVisuals); 3749 bool has_compositing_manager = env->HasVar("_CHROMIUM_INSIDE_XVFB");
Ken Russell (switch to Gerrit) 2016/07/06 22:32:17 This is a hack. Is there no better way to determin
Julien Isorce Samsung 2016/07/07 10:29:23 The idea here is to only do EXPECT_EQ(depth, 32);
3750 int depth = 0;
3751 ui::ChooseVisualForWindow(!has_compositing_manager, NULL, &depth);
3750 3752
3751 int depth = 0; 3753 if (has_compositing_manager)
3752 ui::ChooseVisualForWindow(NULL, &depth); 3754 EXPECT_EQ(depth, 32);
3753 EXPECT_EQ(depth, 32);
3754 #endif 3755 #endif
3755 3756
3756 init_params.opacity = opacity; 3757 init_params.opacity = opacity;
3757 init_params.show_state = ui::SHOW_STATE_NORMAL; 3758 init_params.show_state = ui::SHOW_STATE_NORMAL;
3758 init_params.bounds = gfx::Rect(0, 0, 500, 500); 3759 init_params.bounds = gfx::Rect(0, 0, 500, 500);
3759 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 3760 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
3760 init_params.native_widget = 3761 init_params.native_widget =
3761 CreatePlatformDesktopNativeWidgetImpl(init_params, &widget, nullptr); 3762 CreatePlatformDesktopNativeWidgetImpl(init_params, &widget, nullptr);
3762 widget.Init(init_params); 3763 widget.Init(init_params);
3763 3764
3764 #if defined(USE_X11) 3765 #if defined(USE_X11)
3765 EXPECT_TRUE(widget.IsTranslucentWindowOpacitySupported()); 3766 if (has_compositing_manager)
3767 EXPECT_TRUE(widget.IsTranslucentWindowOpacitySupported());
3766 #endif 3768 #endif
3767 } 3769 }
3768 3770
3769 } // namespace 3771 } // namespace
3770 3772
3771 // Test opacity when compositing is enabled. 3773 // Test opacity when compositing is enabled.
3772 TEST_F(WidgetTest, Transparency_DesktopWidgetInferOpacity) { 3774 TEST_F(WidgetTest, Transparency_DesktopWidgetInferOpacity) {
3773 Widget widget; 3775 Widget widget;
3774 InitializeWidgetForOpacity(widget, 3776 InitializeWidgetForOpacity(widget,
3775 CreateParams(Widget::InitParams::TYPE_WINDOW), 3777 CreateParams(Widget::InitParams::TYPE_WINDOW),
(...skipping 25 matching lines...) Expand all
3801 CreateParams(Widget::InitParams::TYPE_WINDOW), 3803 CreateParams(Widget::InitParams::TYPE_WINDOW),
3802 Widget::InitParams::TRANSLUCENT_WINDOW); 3804 Widget::InitParams::TRANSLUCENT_WINDOW);
3803 EXPECT_EQ(IsNativeWindowTransparent(widget.GetNativeWindow()), 3805 EXPECT_EQ(IsNativeWindowTransparent(widget.GetNativeWindow()),
3804 widget.ShouldWindowContentsBeTransparent()); 3806 widget.ShouldWindowContentsBeTransparent());
3805 } 3807 }
3806 3808
3807 #endif // !defined(OS_CHROMEOS) 3809 #endif // !defined(OS_CHROMEOS)
3808 3810
3809 } // namespace test 3811 } // namespace test
3810 } // namespace views 3812 } // namespace views
OLDNEW
« ui/base/x/x11_util.cc ('K') | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698