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

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: Just make sure the new gpu driver workaround exist in second test instead of using fake values 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
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3712 matching lines...) Expand 10 before | Expand all | Expand 10 after
3733 3733
3734 #if !defined(OS_CHROMEOS) 3734 #if !defined(OS_CHROMEOS)
3735 3735
3736 namespace { 3736 namespace {
3737 3737
3738 void InitializeWidgetForOpacity( 3738 void InitializeWidgetForOpacity(
3739 Widget& widget, 3739 Widget& widget,
3740 Widget::InitParams init_params, 3740 Widget::InitParams init_params,
3741 const Widget::InitParams::WindowOpacity opacity) { 3741 const Widget::InitParams::WindowOpacity opacity) {
3742 #if defined(USE_X11) 3742 #if defined(USE_X11)
3743 // On Linux, transparent visuals is currently not activated by default. 3743 // testing/xvfb.py runs xvfb and xcompmgr.
3744 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 3744 std::unique_ptr<base::Environment> env(base::Environment::Create());
3745 command_line->AppendSwitch(switches::kEnableTransparentVisuals); 3745 bool has_compositing_manager = env->HasVar("_CHROMIUM_INSIDE_XVFB");
3746 int depth = 0;
3747 ui::ChooseVisualForWindow(has_compositing_manager, NULL, &depth);
3746 3748
3747 int depth = 0; 3749 if (has_compositing_manager)
3748 ui::ChooseVisualForWindow(NULL, &depth); 3750 EXPECT_EQ(depth, 32);
3749 EXPECT_EQ(depth, 32);
3750 #endif 3751 #endif
3751 3752
3752 init_params.opacity = opacity; 3753 init_params.opacity = opacity;
3753 init_params.show_state = ui::SHOW_STATE_NORMAL; 3754 init_params.show_state = ui::SHOW_STATE_NORMAL;
3754 init_params.bounds = gfx::Rect(0, 0, 500, 500); 3755 init_params.bounds = gfx::Rect(0, 0, 500, 500);
3755 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 3756 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
3756 init_params.native_widget = 3757 init_params.native_widget =
3757 CreatePlatformDesktopNativeWidgetImpl(init_params, &widget, nullptr); 3758 CreatePlatformDesktopNativeWidgetImpl(init_params, &widget, nullptr);
3758 widget.Init(init_params); 3759 widget.Init(init_params);
3759 3760
3760 #if defined(USE_X11) 3761 #if defined(USE_X11)
3761 EXPECT_TRUE(widget.IsTranslucentWindowOpacitySupported()); 3762 if (has_compositing_manager)
3763 EXPECT_TRUE(widget.IsTranslucentWindowOpacitySupported());
3762 #endif 3764 #endif
3763 } 3765 }
3764 3766
3765 } // namespace 3767 } // namespace
3766 3768
3767 // Test opacity when compositing is enabled. 3769 // Test opacity when compositing is enabled.
3768 TEST_F(WidgetTest, Transparency_DesktopWidgetInferOpacity) { 3770 TEST_F(WidgetTest, Transparency_DesktopWidgetInferOpacity) {
3769 Widget widget; 3771 Widget widget;
3770 InitializeWidgetForOpacity(widget, 3772 InitializeWidgetForOpacity(widget,
3771 CreateParams(Widget::InitParams::TYPE_WINDOW), 3773 CreateParams(Widget::InitParams::TYPE_WINDOW),
(...skipping 25 matching lines...) Expand all
3797 CreateParams(Widget::InitParams::TYPE_WINDOW), 3799 CreateParams(Widget::InitParams::TYPE_WINDOW),
3798 Widget::InitParams::TRANSLUCENT_WINDOW); 3800 Widget::InitParams::TRANSLUCENT_WINDOW);
3799 EXPECT_EQ(IsNativeWindowTransparent(widget.GetNativeWindow()), 3801 EXPECT_EQ(IsNativeWindowTransparent(widget.GetNativeWindow()),
3800 widget.ShouldWindowContentsBeTransparent()); 3802 widget.ShouldWindowContentsBeTransparent());
3801 } 3803 }
3802 3804
3803 #endif // !defined(OS_CHROMEOS) 3805 #endif // !defined(OS_CHROMEOS)
3804 3806
3805 } // namespace test 3807 } // namespace test
3806 } // namespace views 3808 } // namespace views
OLDNEW
« no previous file with comments | « 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