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

Unified Diff: mash/test/mash_test_suite.cc

Issue 2639513002: mash: Do not use InProcessContextFactory in tests. (Closed)
Patch Set: . Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mash/test/mash_test_suite.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/test/mash_test_suite.cc
diff --git a/mash/test/mash_test_suite.cc b/mash/test/mash_test_suite.cc
index 09b369605d08531dad22819ff552c2a9e7a62b88..4a06e47a9dd4af413e4947574dd3aa7329bb0dfa 100644
--- a/mash/test/mash_test_suite.cc
+++ b/mash/test/mash_test_suite.cc
@@ -6,17 +6,55 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
+#include "base/memory/ptr_util.h"
#include "base/path_service.h"
+#include "cc/output/context_provider.h"
+#include "cc/test/test_gpu_memory_buffer_manager.h"
+#include "cc/test/test_task_graph_runner.h"
#include "ui/aura/env.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
-#include "ui/compositor/test/context_factories_for_test.h"
+#include "ui/compositor/compositor.h"
+#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_switches.h"
-#include "ui/gl/test/gl_surface_test_support.h"
namespace mash {
namespace test {
+class TestContextFactory : public ui::ContextFactory {
+ public:
+ TestContextFactory() {}
+ ~TestContextFactory() override {}
+
+ private:
+ // ui::ContextFactory::
+ void CreateCompositorFrameSink(
+ base::WeakPtr<ui::Compositor> compositor) override {}
+ scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider()
+ override {
+ return nullptr;
+ }
+ void RemoveCompositor(ui::Compositor* compositor) override {}
+ bool DoesCreateTestContexts() override { return true; }
+ uint32_t GetImageTextureTarget(gfx::BufferFormat format,
+ gfx::BufferUsage usage) override {
+ return GL_TEXTURE_2D;
+ }
+ gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override {
+ return &gpu_memory_buffer_manager_;
+ }
+ cc::TaskGraphRunner* GetTaskGraphRunner() override {
+ return &task_graph_runner_;
+ }
+ void AddObserver(ui::ContextFactoryObserver* observer) override {}
+ void RemoveObserver(ui::ContextFactoryObserver* observer) override {}
+
+ cc::TestTaskGraphRunner task_graph_runner_;
+ cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestContextFactory);
+};
+
MashTestSuite::MashTestSuite(int argc, char** argv) : TestSuite(argc, argv) {}
MashTestSuite::~MashTestSuite() {}
@@ -35,20 +73,12 @@ void MashTestSuite::Initialize() {
base::DiscardableMemoryAllocator::SetInstance(&discardable_memory_allocator_);
env_ = aura::Env::CreateInstance(aura::Env::Mode::MUS);
- gl::GLSurfaceTestSupport::InitializeOneOff();
- const bool enable_pixel_output = false;
-
- ui::ContextFactory* context_factory = nullptr;
- ui::ContextFactoryPrivate* context_factory_private = nullptr;
- ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory,
- &context_factory_private);
- env_->set_context_factory(context_factory);
- env_->set_context_factory_private(context_factory_private);
+ compositor_context_factory_ = base::MakeUnique<TestContextFactory>();
+ env_->set_context_factory(compositor_context_factory_.get());
}
void MashTestSuite::Shutdown() {
- ui::TerminateContextFactoryForTests();
env_.reset();
ui::ResourceBundle::CleanupSharedInstance();
base::TestSuite::Shutdown();
« no previous file with comments | « mash/test/mash_test_suite.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698