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 "ui/views/test/views_test_base.h" | 5 #include "ui/views/test/views_test_base.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "ui/base/clipboard/clipboard.h" | 11 #include "ui/base/clipboard/clipboard.h" |
12 #include "ui/base/material_design/material_design_controller.h" | 12 #include "ui/base/material_design/material_design_controller.h" |
13 #include "ui/base/test/material_design_controller_test_api.h" | 13 #include "ui/base/test/material_design_controller_test_api.h" |
14 #include "ui/views/test/platform_test_helper.h" | 14 #include "ui/views/test/platform_test_helper.h" |
15 | 15 |
16 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 16 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
17 #include "ui/base/x/x11_util_internal.h" | 17 #include "ui/base/x/x11_util_internal.h" |
18 #endif | 18 #endif |
19 | 19 |
20 namespace views { | 20 namespace views { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 bool InitializeVisuals() { | 24 bool InitializeVisuals() { |
25 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 25 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
26 static int depth = 0; | 26 bool has_compositing_manager = false; |
27 static bool has_compositing_manager = false; | 27 int depth = 0; |
28 bool using_argb_visual; | |
28 | 29 |
29 if (depth > 0) | 30 if (depth > 0) |
30 return has_compositing_manager; | 31 return has_compositing_manager; |
31 | 32 |
32 // testing/xvfb.py runs xvfb and xcompmgr. | 33 // testing/xvfb.py runs xvfb and xcompmgr. |
33 std::unique_ptr<base::Environment> env(base::Environment::Create()); | 34 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
34 has_compositing_manager = env->HasVar("_CHROMIUM_INSIDE_XVFB"); | 35 has_compositing_manager = env->HasVar("_CHROMIUM_INSIDE_XVFB"); |
35 ui::ChooseVisualForWindow(has_compositing_manager, NULL, &depth); | 36 ui::XVisualManager::GetInstance()->ChooseVisualForWindow( |
37 has_compositing_manager, nullptr, &depth, nullptr, &using_argb_visual); | |
36 | 38 |
Julien Isorce Samsung
2016/09/28 17:42:52
Has it really a chance to return depth 32 since XV
Tom (Use chromium acct)
2016/09/28 18:36:01
The views tests are not failing, so it would appea
| |
37 if (has_compositing_manager) | 39 if (using_argb_visual) |
38 EXPECT_EQ(32, depth); | 40 EXPECT_EQ(32, depth); |
39 | 41 |
40 return has_compositing_manager; | 42 return using_argb_visual; |
41 #else | 43 #else |
42 return false; | 44 return false; |
43 #endif | 45 #endif |
44 } | 46 } |
45 | 47 |
46 } // namespace | 48 } // namespace |
47 | 49 |
48 ViewsTestBase::ViewsTestBase() | 50 ViewsTestBase::ViewsTestBase() |
49 : setup_called_(false), | 51 : setup_called_(false), |
50 teardown_called_(false), | 52 teardown_called_(false), |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 | 103 |
102 gfx::NativeWindow ViewsTestBase::GetContext() { | 104 gfx::NativeWindow ViewsTestBase::GetContext() { |
103 return test_helper_->GetContext(); | 105 return test_helper_->GetContext(); |
104 } | 106 } |
105 | 107 |
106 bool ViewsTestBase::HasCompositingManager() const { | 108 bool ViewsTestBase::HasCompositingManager() const { |
107 return has_compositing_manager_; | 109 return has_compositing_manager_; |
108 } | 110 } |
109 | 111 |
110 } // namespace views | 112 } // namespace views |
OLD | NEW |