From 15edee45516a54fd066c2ca60b0f9ca4f5baae28 Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Mon, 10 Oct 2011 21:07:09 +0000 Subject: Move some testing classes used by chrome to content\renderer, to match what we're doing with other test classes. BUG=98716 Review URL: http://codereview.chromium.org/8216019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104781 0039d316-1c4b-4281-b951-d872f2087c98 --- content/test/mock_render_process.cc | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 content/test/mock_render_process.cc (limited to 'content/test/mock_render_process.cc') diff --git a/content/test/mock_render_process.cc b/content/test/mock_render_process.cc new file mode 100644 index 0000000..0bce202 --- /dev/null +++ b/content/test/mock_render_process.cc @@ -0,0 +1,44 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/test/mock_render_process.h" + +#include "ui/gfx/rect.h" +#include "ui/gfx/surface/transport_dib.h" + +MockRenderProcess::MockRenderProcess() + : transport_dib_next_sequence_number_(0) { +} + +MockRenderProcess::~MockRenderProcess() { +} + +skia::PlatformCanvas* MockRenderProcess::GetDrawingCanvas( + TransportDIB** memory, + const gfx::Rect& rect) { + size_t stride = skia::PlatformCanvas::StrideForWidth(rect.width()); + size_t size = stride * rect.height(); + + // Unlike RenderProcessImpl, when we're a test, we can just create transport + // DIBs in the current process, since there is no sandbox protecting us (and + // no browser process to ask for one in any case). + *memory = TransportDIB::Create(size, transport_dib_next_sequence_number_++); + if (!*memory) + return NULL; + return (*memory)->GetPlatformCanvas(rect.width(), rect.height()); +} + +void MockRenderProcess::ReleaseTransportDIB(TransportDIB* memory) { + delete memory; +} + +bool MockRenderProcess::UseInProcessPlugins() const { + return true; +} + +bool MockRenderProcess::HasInitializedMediaLibrary() const { + return false; +} + + -- cgit v1.1