| 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 Visual* visual; |
| 28 int depth = 0; |
| 29 Colormap colormap; |
| 30 bool using_argb_visual; |
| 28 | 31 |
| 29 if (depth > 0) | 32 if (depth > 0) |
| 30 return has_compositing_manager; | 33 return has_compositing_manager; |
| 31 | 34 |
| 32 // testing/xvfb.py runs xvfb and xcompmgr. | 35 // testing/xvfb.py runs xvfb and xcompmgr. |
| 33 std::unique_ptr<base::Environment> env(base::Environment::Create()); | 36 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
| 34 has_compositing_manager = env->HasVar("_CHROMIUM_INSIDE_XVFB"); | 37 has_compositing_manager = env->HasVar("_CHROMIUM_INSIDE_XVFB"); |
| 35 ui::ChooseVisualForWindow(has_compositing_manager, NULL, &depth); | 38 ui::XVisualManager::GetInstance()->ChooseVisualForWindow( |
| 39 has_compositing_manager, &visual, &depth, &colormap, &using_argb_visual); |
| 36 | 40 |
| 37 if (has_compositing_manager) | 41 if (using_argb_visual) |
| 38 EXPECT_EQ(32, depth); | 42 EXPECT_EQ(32, depth); |
| 39 | 43 |
| 40 return has_compositing_manager; | 44 return using_argb_visual; |
| 41 #else | 45 #else |
| 42 return false; | 46 return false; |
| 43 #endif | 47 #endif |
| 44 } | 48 } |
| 45 | 49 |
| 46 } // namespace | 50 } // namespace |
| 47 | 51 |
| 48 ViewsTestBase::ViewsTestBase() | 52 ViewsTestBase::ViewsTestBase() |
| 49 : setup_called_(false), | 53 : setup_called_(false), |
| 50 teardown_called_(false), | 54 teardown_called_(false), |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 105 |
| 102 gfx::NativeWindow ViewsTestBase::GetContext() { | 106 gfx::NativeWindow ViewsTestBase::GetContext() { |
| 103 return test_helper_->GetContext(); | 107 return test_helper_->GetContext(); |
| 104 } | 108 } |
| 105 | 109 |
| 106 bool ViewsTestBase::HasCompositingManager() const { | 110 bool ViewsTestBase::HasCompositingManager() const { |
| 107 return has_compositing_manager_; | 111 return has_compositing_manager_; |
| 108 } | 112 } |
| 109 | 113 |
| 110 } // namespace views | 114 } // namespace views |
| OLD | NEW |