summaryrefslogtreecommitdiffstats
path: root/app/gfx/gl/gl_context_stub.h
blob: 222bf7b1ae901acbf0f9bf1f996354048e9eab17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2010 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.

// This file implements the StubGLContext.

#ifndef APP_GFX_GL_GL_CONTEXT_STUB_H_
#define APP_GFX_GL_GL_CONTEXT_STUB_H_
#pragma once

#include "app/gfx/gl/gl_context.h"

namespace gfx {

// A GLContext that does nothing for unit tests.
class StubGLContext : public gfx::GLContext {
 public:
  // Implement GLContext.
  virtual void Destroy() {}
  virtual bool MakeCurrent() { return true; }
  virtual bool IsCurrent() { return true; }
  virtual bool IsOffscreen() { return false; }
  virtual void SwapBuffers() {}
  virtual gfx::Size GetSize() { return size_; }
  virtual void* GetHandle() { return NULL; }

  void SetSize(const gfx::Size& size) { size_ = size; }

 private:
  gfx::Size size_;
};

}  // namespace gfx

#endif  // APP_GFX_GL_GL_CONTEXT_STUB_H_