Fix build break
[chromium-blink-merge.git] / content / test / mock_render_process.cc
blob300dfe4df96f5629f748f15334b3b03235e6a5dc
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
3 // found in the LICENSE file.
5 #include "content/test/mock_render_process.h"
7 #include "ui/gfx/rect.h"
8 #include "ui/surface/transport_dib.h"
10 namespace content {
12 MockRenderProcess::MockRenderProcess()
13 : transport_dib_next_sequence_number_(0),
14 enabled_bindings_(0) {
17 MockRenderProcess::~MockRenderProcess() {
20 skia::PlatformCanvas* MockRenderProcess::GetDrawingCanvas(
21 TransportDIB** memory,
22 const gfx::Rect& rect) {
23 size_t stride = skia::PlatformCanvasStrideForWidth(rect.width());
24 size_t size = stride * rect.height();
26 // Unlike RenderProcessImpl, when we're a test, we can just create transport
27 // DIBs in the current process, since there is no sandbox protecting us (and
28 // no browser process to ask for one in any case).
29 *memory = TransportDIB::Create(size, transport_dib_next_sequence_number_++);
30 if (!*memory)
31 return NULL;
32 return (*memory)->GetPlatformCanvas(rect.width(), rect.height());
35 void MockRenderProcess::ReleaseTransportDIB(TransportDIB* memory) {
36 delete memory;
39 bool MockRenderProcess::UseInProcessPlugins() const {
40 return true;
43 void MockRenderProcess::AddBindings(int bindings) {
44 enabled_bindings_ |= bindings;
47 int MockRenderProcess::GetEnabledBindings() const {
48 return enabled_bindings_;
51 TransportDIB* MockRenderProcess::CreateTransportDIB(size_t size) {
52 return TransportDIB::Create(size, transport_dib_next_sequence_number_++);
55 void MockRenderProcess::FreeTransportDIB(TransportDIB* dib) {
56 delete dib;
59 } // namespace content