| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
| 13 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 13 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 14 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 14 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 15 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 15 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 16 #include "gpu/command_buffer/service/context_group.h" | 16 #include "gpu/command_buffer/service/context_group.h" |
| 17 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 17 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
| 18 #include "gpu/command_buffer/service/logger.h" | 18 #include "gpu/command_buffer/service/logger.h" |
| 19 #include "gpu/command_buffer/service/program_manager.h" | 19 #include "gpu/command_buffer/service/program_manager.h" |
| 20 #include "gpu/command_buffer/service/test_helper.h" | 20 #include "gpu/command_buffer/service/test_helper.h" |
| 21 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 21 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "ui/gl/gl_implementation.h" | 23 #include "ui/gl/gl_implementation.h" |
| 24 #include "ui/gl/gl_mock.h" | 24 #include "ui/gl/gl_mock.h" |
| 25 #include "ui/gl/gl_surface.h" | |
| 26 | 25 |
| 27 using ::gfx::MockGLInterface; | 26 using ::gfx::MockGLInterface; |
| 28 using ::testing::_; | 27 using ::testing::_; |
| 29 using ::testing::DoAll; | 28 using ::testing::DoAll; |
| 30 using ::testing::InSequence; | 29 using ::testing::InSequence; |
| 31 using ::testing::MatcherCast; | 30 using ::testing::MatcherCast; |
| 32 using ::testing::Pointee; | 31 using ::testing::Pointee; |
| 33 using ::testing::Return; | 32 using ::testing::Return; |
| 34 using ::testing::SetArrayArgument; | 33 using ::testing::SetArrayArgument; |
| 35 using ::testing::SetArgPointee; | 34 using ::testing::SetArgPointee; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 bool has_alpha, | 108 bool has_alpha, |
| 110 bool has_depth, | 109 bool has_depth, |
| 111 bool has_stencil, | 110 bool has_stencil, |
| 112 bool request_alpha, | 111 bool request_alpha, |
| 113 bool request_depth, | 112 bool request_depth, |
| 114 bool request_stencil, | 113 bool request_stencil, |
| 115 bool bind_generates_resource, | 114 bool bind_generates_resource, |
| 116 const CommandLine* command_line) { | 115 const CommandLine* command_line) { |
| 117 Framebuffer::ClearFramebufferCompleteComboMap(); | 116 Framebuffer::ClearFramebufferCompleteComboMap(); |
| 118 | 117 |
| 118 gfx::ClearGLBindings(); |
| 119 gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress); | 119 gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress); |
| 120 gfx::GLSurface::InitializeOneOffWithMockBindingsForTests(); | 120 gfx::InitializeStaticGLBindings(gfx::kGLImplementationMockGL); |
| 121 | 121 |
| 122 gl_.reset(new StrictMock<MockGLInterface>()); | 122 gl_.reset(new StrictMock<MockGLInterface>()); |
| 123 ::gfx::MockGLInterface::SetGLInterface(gl_.get()); | 123 ::gfx::MockGLInterface::SetGLInterface(gl_.get()); |
| 124 | 124 |
| 125 // Only create stream texture manager if extension is requested. | 125 // Only create stream texture manager if extension is requested. |
| 126 std::vector<std::string> list; | 126 std::vector<std::string> list; |
| 127 base::SplitString(std::string(extensions), ' ', &list); | 127 base::SplitString(std::string(extensions), ' ', &list); |
| 128 scoped_refptr<FeatureInfo> feature_info; | 128 scoped_refptr<FeatureInfo> feature_info; |
| 129 if (command_line) | 129 if (command_line) |
| 130 feature_info = new FeatureInfo(*command_line); | 130 feature_info = new FeatureInfo(*command_line); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 shared_memory_base_ = buffer.ptr; | 282 shared_memory_base_ = buffer.ptr; |
| 283 | 283 |
| 284 surface_ = new gfx::GLSurfaceStub; | 284 surface_ = new gfx::GLSurfaceStub; |
| 285 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight)); | 285 surface_->SetSize(gfx::Size(kBackBufferWidth, kBackBufferHeight)); |
| 286 | 286 |
| 287 context_ = new gfx::GLContextStubWithExtensions; | 287 context_ = new gfx::GLContextStubWithExtensions; |
| 288 context_->AddExtensionsString(extensions); | 288 context_->AddExtensionsString(extensions); |
| 289 context_->SetGLVersionString(gl_version); | 289 context_->SetGLVersionString(gl_version); |
| 290 | 290 |
| 291 context_->MakeCurrent(surface_.get()); | 291 context_->MakeCurrent(surface_.get()); |
| 292 gfx::GLSurface::InitializeDynamicMockBindingsForTests(context_); | 292 gfx::InitializeDynamicGLBindings(gfx::kGLImplementationMockGL, context_); |
| 293 | 293 |
| 294 int32 attributes[] = { | 294 int32 attributes[] = { |
| 295 EGL_ALPHA_SIZE, request_alpha ? 8 : 0, | 295 EGL_ALPHA_SIZE, request_alpha ? 8 : 0, |
| 296 EGL_DEPTH_SIZE, request_depth ? 24 : 0, | 296 EGL_DEPTH_SIZE, request_depth ? 24 : 0, |
| 297 EGL_STENCIL_SIZE, request_stencil ? 8 : 0, | 297 EGL_STENCIL_SIZE, request_stencil ? 8 : 0, |
| 298 }; | 298 }; |
| 299 std::vector<int32> attribs(attributes, attributes + arraysize(attributes)); | 299 std::vector<int32> attribs(attributes, attributes + arraysize(attributes)); |
| 300 | 300 |
| 301 decoder_.reset(GLES2Decoder::Create(group_.get())); | 301 decoder_.reset(GLES2Decoder::Create(group_.get())); |
| 302 decoder_->GetLogger()->set_log_synthesized_gl_errors(false); | 302 decoder_->GetLogger()->set_log_synthesized_gl_errors(false); |
| (...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 SetupDefaultProgram(); | 1435 SetupDefaultProgram(); |
| 1436 } | 1436 } |
| 1437 | 1437 |
| 1438 // Include the auto-generated part of this file. We split this because it means | 1438 // Include the auto-generated part of this file. We split this because it means |
| 1439 // we can easily edit the non-auto generated parts right here in this file | 1439 // we can easily edit the non-auto generated parts right here in this file |
| 1440 // instead of having to edit some template or the code generator. | 1440 // instead of having to edit some template or the code generator. |
| 1441 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 1441 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
| 1442 | 1442 |
| 1443 } // namespace gles2 | 1443 } // namespace gles2 |
| 1444 } // namespace gpu | 1444 } // namespace gpu |
| OLD | NEW |