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

Unified Diff: cc/test/pixel_test.cc

Issue 14135011: cc: Add software renderer pixel tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fuzzy only for software Created 7 years, 8 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 | « cc/test/pixel_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/pixel_test.cc
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index 5976ae350db3ecc0af2c04beec660f975b531050..297f542820dbfec14d6a2f51f9264aa43ac555f5 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -8,6 +8,7 @@
#include "cc/output/compositor_frame_metadata.h"
#include "cc/output/gl_renderer.h"
#include "cc/output/output_surface.h"
+#include "cc/output/software_renderer.h"
#include "cc/resources/resource_provider.h"
#include "cc/test/paths.h"
#include "cc/test/pixel_test_utils.h"
@@ -50,33 +51,12 @@ class PixelTest::PixelTestRendererClient : public RendererClient {
LayerTreeSettings settings_;
};
-PixelTest::PixelTest() : device_viewport_size_(gfx::Size(200, 200)) {}
+PixelTest::PixelTest()
+ : device_viewport_size_(gfx::Size(200, 200)),
+ fake_client_(new PixelTestRendererClient(device_viewport_size_)) {}
PixelTest::~PixelTest() {}
-void PixelTest::SetUp() {
- CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL));
-
- using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
- scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d(
- WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
- WebKit::WebGraphicsContext3D::Attributes()));
- output_surface_.reset(new OutputSurface(
- context3d.PassAs<WebKit::WebGraphicsContext3D>()));
- resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0);
- fake_client_ =
- make_scoped_ptr(new PixelTestRendererClient(device_viewport_size_));
- renderer_ = GLRenderer::Create(fake_client_.get(),
- output_surface_.get(),
- resource_provider_.get(),
- 0);
-
- scoped_refptr<webkit::gpu::ContextProviderInProcess> offscreen_contexts =
- webkit::gpu::ContextProviderInProcess::Create();
- ASSERT_TRUE(offscreen_contexts->BindToCurrentThread());
- resource_provider_->set_offscreen_context_provider(offscreen_contexts);
-}
-
bool PixelTest::RunPixelTest(RenderPassList* pass_list,
const base::FilePath& ref_file,
const PixelComparator& comparator) {
@@ -113,4 +93,38 @@ bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file,
comparator);
}
+void PixelTest::SetUpGLRenderer() {
+ CHECK(fake_client_);
+ CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL));
+
+ using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
+ scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d(
+ WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
+ WebKit::WebGraphicsContext3D::Attributes()));
+ output_surface_.reset(new OutputSurface(
+ context3d.PassAs<WebKit::WebGraphicsContext3D>()));
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0);
+ renderer_ = GLRenderer::Create(fake_client_.get(),
+ output_surface_.get(),
+ resource_provider_.get(),
+ 0).PassAs<DirectRenderer>();
+
+ scoped_refptr<webkit::gpu::ContextProviderInProcess> offscreen_contexts =
+ webkit::gpu::ContextProviderInProcess::Create();
+ ASSERT_TRUE(offscreen_contexts->BindToCurrentThread());
+ resource_provider_->set_offscreen_context_provider(offscreen_contexts);
+}
+
+void PixelTest::SetUpSoftwareRenderer() {
+ CHECK(fake_client_);
+
+ scoped_ptr<SoftwareOutputDevice> device(new SoftwareOutputDevice());
+ output_surface_.reset(new OutputSurface(device.Pass()));
+ resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0);
+ renderer_ = SoftwareRenderer::Create(
+ fake_client_.get(),
+ output_surface_.get(),
+ resource_provider_.get()).PassAs<DirectRenderer>();
+}
+
} // namespace cc
« no previous file with comments | « cc/test/pixel_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698