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

Side by Side Diff: mash/test/mash_test_suite.cc

Issue 2714393002: ash: Low-latency laser pointer. (Closed)
Patch Set: remove :surfaces Created 3 years, 9 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 | « mash/test/DEPS ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "mash/test/mash_test_suite.h" 5 #include "mash/test/mash_test_suite.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "cc/output/context_provider.h" 11 #include "cc/output/context_provider.h"
12 #include "cc/surfaces/frame_sink_id_allocator.h"
13 #include "cc/surfaces/surface_manager.h"
12 #include "cc/test/test_gpu_memory_buffer_manager.h" 14 #include "cc/test/test_gpu_memory_buffer_manager.h"
13 #include "cc/test/test_task_graph_runner.h" 15 #include "cc/test/test_task_graph_runner.h"
14 #include "ui/aura/env.h" 16 #include "ui/aura/env.h"
15 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/base/ui_base_paths.h" 18 #include "ui/base/ui_base_paths.h"
17 #include "ui/compositor/compositor.h" 19 #include "ui/compositor/compositor.h"
20 #include "ui/compositor/reflector.h"
18 #include "ui/gl/gl_bindings.h" 21 #include "ui/gl/gl_bindings.h"
19 #include "ui/gl/gl_switches.h" 22 #include "ui/gl/gl_switches.h"
20 #include "ui/gl/test/gl_surface_test_support.h" 23 #include "ui/gl/test/gl_surface_test_support.h"
21 24
22 namespace mash { 25 namespace mash {
23 namespace test { 26 namespace test {
24 27
25 class TestContextFactory : public ui::ContextFactory { 28 class TestContextFactory : public ui::ContextFactory,
29 public ui::ContextFactoryPrivate {
26 public: 30 public:
27 TestContextFactory() {} 31 TestContextFactory() : frame_sink_id_allocator_(0) {}
28 ~TestContextFactory() override {} 32 ~TestContextFactory() override {}
29 33
30 private: 34 private:
31 // ui::ContextFactory:: 35 // ui::ContextFactory::
32 void CreateCompositorFrameSink( 36 void CreateCompositorFrameSink(
33 base::WeakPtr<ui::Compositor> compositor) override {} 37 base::WeakPtr<ui::Compositor> compositor) override {}
34 scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() 38 scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider()
35 override { 39 override {
36 return nullptr; 40 return nullptr;
37 } 41 }
38 void RemoveCompositor(ui::Compositor* compositor) override {} 42 void RemoveCompositor(ui::Compositor* compositor) override {}
39 bool DoesCreateTestContexts() override { return true; } 43 bool DoesCreateTestContexts() override { return true; }
40 uint32_t GetImageTextureTarget(gfx::BufferFormat format, 44 uint32_t GetImageTextureTarget(gfx::BufferFormat format,
41 gfx::BufferUsage usage) override { 45 gfx::BufferUsage usage) override {
42 return GL_TEXTURE_2D; 46 return GL_TEXTURE_2D;
43 } 47 }
44 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override { 48 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override {
45 return &gpu_memory_buffer_manager_; 49 return &gpu_memory_buffer_manager_;
46 } 50 }
47 cc::TaskGraphRunner* GetTaskGraphRunner() override { 51 cc::TaskGraphRunner* GetTaskGraphRunner() override {
48 return &task_graph_runner_; 52 return &task_graph_runner_;
49 } 53 }
50 void AddObserver(ui::ContextFactoryObserver* observer) override {} 54 void AddObserver(ui::ContextFactoryObserver* observer) override {}
51 void RemoveObserver(ui::ContextFactoryObserver* observer) override {} 55 void RemoveObserver(ui::ContextFactoryObserver* observer) override {}
52 56
57 // ui::ContextFactoryPrivate:
58 std::unique_ptr<ui::Reflector> CreateReflector(
59 ui::Compositor* mirrored_compositor,
60 ui::Layer* mirroring_layer) override {
61 return nullptr;
62 }
63 void RemoveReflector(ui::Reflector* reflector) override {}
64 cc::FrameSinkId AllocateFrameSinkId() override {
65 return frame_sink_id_allocator_.NextFrameSinkId();
66 }
67 cc::SurfaceManager* GetSurfaceManager() override { return &surface_manager_; }
68 void SetDisplayVisible(ui::Compositor* compositor, bool visible) override {}
69 void ResizeDisplay(ui::Compositor* compositor,
70 const gfx::Size& size) override {}
71 void SetDisplayColorSpace(ui::Compositor* compositor,
72 const gfx::ColorSpace& color_space) override {}
73 void SetAuthoritativeVSyncInterval(ui::Compositor* compositor,
74 base::TimeDelta interval) override {}
75 void SetDisplayVSyncParameters(ui::Compositor* compositor,
76 base::TimeTicks timebase,
77 base::TimeDelta interval) override {}
78 void SetOutputIsSecure(ui::Compositor* compositor, bool secure) override {}
79
53 cc::TestTaskGraphRunner task_graph_runner_; 80 cc::TestTaskGraphRunner task_graph_runner_;
54 cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_; 81 cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
82 cc::FrameSinkIdAllocator frame_sink_id_allocator_;
83 cc::SurfaceManager surface_manager_;
55 84
56 DISALLOW_COPY_AND_ASSIGN(TestContextFactory); 85 DISALLOW_COPY_AND_ASSIGN(TestContextFactory);
57 }; 86 };
58 87
59 MashTestSuite::MashTestSuite(int argc, char** argv) : TestSuite(argc, argv) {} 88 MashTestSuite::MashTestSuite(int argc, char** argv) : TestSuite(argc, argv) {}
60 89
61 MashTestSuite::~MashTestSuite() {} 90 MashTestSuite::~MashTestSuite() {}
62 91
63 void MashTestSuite::Initialize() { 92 void MashTestSuite::Initialize() {
64 base::TestSuite::Initialize(); 93 base::TestSuite::Initialize();
65 gl::GLSurfaceTestSupport::InitializeOneOff(); 94 gl::GLSurfaceTestSupport::InitializeOneOff();
66 95
67 base::CommandLine::ForCurrentProcess()->AppendSwitch( 96 base::CommandLine::ForCurrentProcess()->AppendSwitch(
68 switches::kOverrideUseSoftwareGLForTests); 97 switches::kOverrideUseSoftwareGLForTests);
69 98
70 // Load ash mus strings and resources; not 'common' (Chrome) resources. 99 // Load ash mus strings and resources; not 'common' (Chrome) resources.
71 base::FilePath resources; 100 base::FilePath resources;
72 PathService::Get(base::DIR_MODULE, &resources); 101 PathService::Get(base::DIR_MODULE, &resources);
73 resources = resources.Append(FILE_PATH_LITERAL("ash_mus_resources.pak")); 102 resources = resources.Append(FILE_PATH_LITERAL("ash_mus_resources.pak"));
74 ui::ResourceBundle::InitSharedInstanceWithPakPath(resources); 103 ui::ResourceBundle::InitSharedInstanceWithPakPath(resources);
75 104
76 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_); 105 base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_);
77 env_ = aura::Env::CreateInstance(aura::Env::Mode::MUS); 106 env_ = aura::Env::CreateInstance(aura::Env::Mode::MUS);
78 107
79 compositor_context_factory_ = base::MakeUnique<TestContextFactory>(); 108 compositor_context_factory_ = base::MakeUnique<TestContextFactory>();
80 env_->set_context_factory(compositor_context_factory_.get()); 109 env_->set_context_factory(compositor_context_factory_.get());
110 env_->set_context_factory_private(compositor_context_factory_.get());
81 } 111 }
82 112
83 void MashTestSuite::Shutdown() { 113 void MashTestSuite::Shutdown() {
84 env_.reset(); 114 env_.reset();
85 ui::ResourceBundle::CleanupSharedInstance(); 115 ui::ResourceBundle::CleanupSharedInstance();
86 base::TestSuite::Shutdown(); 116 base::TestSuite::Shutdown();
87 } 117 }
88 118
89 } // namespace test 119 } // namespace test
90 } // namespace mash 120 } // namespace mash
OLDNEW
« no previous file with comments | « mash/test/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698