Revert "Merged all Chromoting Host code into remoting_core.dll (Windows)."
[chromium-blink-merge.git] / cc / test / fake_output_surface.cc
blobebbe7832b167284c658db7e168433797148d81ba
1 // Copyright 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 "cc/test/fake_output_surface.h"
7 namespace cc {
9 FakeOutputSurface::FakeOutputSurface(
10 scoped_ptr<WebKit::WebGraphicsContext3D> context3d, bool has_parent)
11 : num_sent_frames_(0) {
12 context3d_ = context3d.Pass();
13 capabilities_.has_parent_compositor = has_parent;
16 FakeOutputSurface::FakeOutputSurface(
17 scoped_ptr<SoftwareOutputDevice> software_device, bool has_parent)
18 : num_sent_frames_(0) {
19 software_device_ = software_device.Pass();
20 capabilities_.has_parent_compositor = has_parent;
23 FakeOutputSurface::~FakeOutputSurface() {}
25 bool FakeOutputSurface::BindToClient(OutputSurfaceClient* client) {
26 if (!context3d_)
27 return true;
28 DCHECK(client);
29 if (!context3d_->makeContextCurrent())
30 return false;
31 client_ = client;
32 return true;
35 const struct OutputSurface::Capabilities& FakeOutputSurface::Capabilities()
36 const {
37 return capabilities_;
40 WebKit::WebGraphicsContext3D* FakeOutputSurface::Context3D() const {
41 return context3d_.get();
44 SoftwareOutputDevice* FakeOutputSurface::SoftwareDevice() const {
45 return software_device_.get();
48 void FakeOutputSurface::SendFrameToParentCompositor(
49 CompositorFrame* frame) {
50 frame->AssignTo(&last_sent_frame_);
51 ++num_sent_frames_;
54 } // namespace cc