OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file implements the StubGLContext. | 5 // This file implements the StubGLContext. |
6 | 6 |
7 #ifndef APP_GFX_GL_GL_CONTEXT_STUB_H_ | 7 #ifndef APP_GFX_GL_GL_CONTEXT_STUB_H_ |
8 #define APP_GFX_GL_GL_CONTEXT_STUB_H_ | 8 #define APP_GFX_GL_GL_CONTEXT_STUB_H_ |
9 #pragma once | 9 #pragma once |
10 | 10 |
11 #include "app/gfx/gl/gl_context.h" | 11 #include "app/gfx/gl/gl_context.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 | 14 |
15 // A GLContext that does nothing for unit tests. | 15 // A GLContext that does nothing for unit tests. |
16 class StubGLContext : public gfx::GLContext { | 16 class StubGLContext : public gfx::GLContext { |
17 public: | 17 public: |
| 18 virtual ~StubGLContext(); |
| 19 |
18 // Implement GLContext. | 20 // Implement GLContext. |
19 virtual void Destroy() {} | 21 virtual void Destroy() {} |
20 virtual bool MakeCurrent() { return true; } | 22 virtual bool MakeCurrent(); |
21 virtual bool IsCurrent() { return true; } | 23 virtual bool IsCurrent(); |
22 virtual bool IsOffscreen() { return false; } | 24 virtual bool IsOffscreen(); |
23 virtual bool SwapBuffers() { return true; } | 25 virtual bool SwapBuffers(); |
24 virtual gfx::Size GetSize() { return size_; } | 26 virtual gfx::Size GetSize(); |
25 virtual void* GetHandle() { return NULL; } | 27 virtual void* GetHandle(); |
26 virtual void SetSwapInterval(int interval) {} | 28 virtual void SetSwapInterval(int interval) {} |
27 virtual std::string GetExtensions() { return std::string(); } | 29 virtual std::string GetExtensions(); |
28 | 30 |
29 void SetSize(const gfx::Size& size) { size_ = size; } | 31 void SetSize(const gfx::Size& size) { size_ = size; } |
30 | 32 |
31 private: | 33 private: |
32 gfx::Size size_; | 34 gfx::Size size_; |
33 }; | 35 }; |
34 | 36 |
35 } // namespace gfx | 37 } // namespace gfx |
36 | 38 |
37 #endif // APP_GFX_GL_GL_CONTEXT_STUB_H_ | 39 #endif // APP_GFX_GL_GL_CONTEXT_STUB_H_ |
OLD | NEW |