| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/gl/gpu_timing.h" | 5 #include "ui/gl/gpu_timing.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 GLSurfaceTestSupport::InitializeOneOffWithMockBindings(); | 53 GLSurfaceTestSupport::InitializeOneOffWithMockBindings(); |
| 54 gl_.reset(new ::testing::StrictMock<MockGLInterface>()); | 54 gl_.reset(new ::testing::StrictMock<MockGLInterface>()); |
| 55 MockGLInterface::SetGLInterface(gl_.get()); | 55 MockGLInterface::SetGLInterface(gl_.get()); |
| 56 | 56 |
| 57 context_ = new GLContextStubWithExtensions; | 57 context_ = new GLContextStubWithExtensions; |
| 58 context_->AddExtensionsString(gl_extensions); | 58 context_->AddExtensionsString(gl_extensions); |
| 59 context_->SetGLVersionString(gl_version); | 59 context_->SetGLVersionString(gl_version); |
| 60 surface_ = new GLSurfaceStub; | 60 surface_ = new GLSurfaceStub; |
| 61 context_->MakeCurrent(surface_.get()); | 61 context_->MakeCurrent(surface_.get()); |
| 62 gpu_timing_fake_queries_.Reset(); | 62 gpu_timing_fake_queries_.Reset(); |
| 63 GLSurfaceTestSupport::InitializeDynamicMockBindings(context_.get()); | |
| 64 | 63 |
| 65 setup_ = true; | 64 setup_ = true; |
| 66 } | 65 } |
| 67 | 66 |
| 68 scoped_refptr<GPUTimingClient> CreateGPUTimingClient() { | 67 scoped_refptr<GPUTimingClient> CreateGPUTimingClient() { |
| 69 if (!setup_) { | 68 if (!setup_) { |
| 70 SetupGLContext("2.0", ""); | 69 SetupGLContext("2.0", ""); |
| 71 } | 70 } |
| 72 | 71 |
| 73 scoped_refptr<GPUTimingClient> client = context_->CreateGPUTimingClient(); | 72 scoped_refptr<GPUTimingClient> client = context_->CreateGPUTimingClient(); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 208 |
| 210 int64_t start, end; | 209 int64_t start, end; |
| 211 gpu_timer->GetStartEndTimestamps(&start, &end); | 210 gpu_timer->GetStartEndTimestamps(&start, &end); |
| 212 // Force time elapsed won't be set until a query is actually attempted | 211 // Force time elapsed won't be set until a query is actually attempted |
| 213 ASSERT_TRUE(client->IsForceTimeElapsedQuery()); | 212 ASSERT_TRUE(client->IsForceTimeElapsedQuery()); |
| 214 EXPECT_EQ(begin_cpu_time, start); | 213 EXPECT_EQ(begin_cpu_time, start); |
| 215 EXPECT_EQ(begin_cpu_time, end); | 214 EXPECT_EQ(begin_cpu_time, end); |
| 216 } | 215 } |
| 217 | 216 |
| 218 } // namespace gl | 217 } // namespace gl |
| OLD | NEW |