| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <map> | 5 #include <map> |
| 6 #include <set> | 6 #include <set> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
| 10 #include "gpu/command_buffer/service/gpu_service_test.h" | 10 #include "gpu/command_buffer/service/gpu_service_test.h" |
| 11 #include "gpu/command_buffer/service/gpu_timing.h" | |
| 12 #include "gpu/command_buffer/service/gpu_tracer.h" | 11 #include "gpu/command_buffer/service/gpu_tracer.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/gl/gl_mock.h" | 13 #include "ui/gl/gl_mock.h" |
| 14 #include "ui/gl/gpu_timing.h" |
| 15 | 15 |
| 16 namespace gpu { | 16 namespace gpu { |
| 17 namespace gles2 { | 17 namespace gles2 { |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 using ::testing::_; | 20 using ::testing::_; |
| 21 using ::testing::AtLeast; | 21 using ::testing::AtLeast; |
| 22 using ::testing::AtMost; | 22 using ::testing::AtMost; |
| 23 using ::testing::Exactly; | 23 using ::testing::Exactly; |
| 24 using ::testing::Invoke; | 24 using ::testing::Invoke; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 GLint64 current_time_ = 0; | 145 GLint64 current_time_ = 0; |
| 146 GLuint next_query_id_ = 0; | 146 GLuint next_query_id_ = 0; |
| 147 std::set<GLuint> alloced_queries_; | 147 std::set<GLuint> alloced_queries_; |
| 148 std::map<GLuint, GLint64> query_timestamp_; | 148 std::map<GLuint, GLint64> query_timestamp_; |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 class GPUTracerTester : public GPUTracer { | 151 class GPUTracerTester : public GPUTracer { |
| 152 public: | 152 public: |
| 153 explicit GPUTracerTester(gles2::GLES2Decoder* decoder) | 153 explicit GPUTracerTester(gles2::GLES2Decoder* decoder) |
| 154 : GPUTracer(decoder), tracing_enabled_(0) { | 154 : GPUTracer(decoder), tracing_enabled_(0) { |
| 155 gpu_timing_.SetCpuTimeForTesting(base::Bind(&FakeCpuTime)); | 155 gpu_timing_client_->SetCpuTimeForTesting(base::Bind(&FakeCpuTime)); |
| 156 | 156 |
| 157 // Force tracing to be dependent on our mock variable here. | 157 // Force tracing to be dependent on our mock variable here. |
| 158 gpu_trace_srv_category = &tracing_enabled_; | 158 gpu_trace_srv_category = &tracing_enabled_; |
| 159 gpu_trace_dev_category = &tracing_enabled_; | 159 gpu_trace_dev_category = &tracing_enabled_; |
| 160 } | 160 } |
| 161 | 161 |
| 162 ~GPUTracerTester() override {} | 162 ~GPUTracerTester() override {} |
| 163 | 163 |
| 164 void SetTracingEnabled(bool enabled) { | 164 void SetTracingEnabled(bool enabled) { |
| 165 tracing_enabled_ = enabled ? 1 : 0; | 165 tracing_enabled_ = enabled ? 1 : 0; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 182 Process(); | 182 Process(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 unsigned char tracing_enabled_; | 185 unsigned char tracing_enabled_; |
| 186 | 186 |
| 187 scoped_refptr<Outputter> set_outputter_; | 187 scoped_refptr<Outputter> set_outputter_; |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 class BaseGpuTest : public GpuServiceTest { | 190 class BaseGpuTest : public GpuServiceTest { |
| 191 public: | 191 public: |
| 192 explicit BaseGpuTest(GPUTiming::TimerType test_timer_type) | 192 explicit BaseGpuTest(gfx::GPUTiming::TimerType test_timer_type) |
| 193 : test_timer_type_(test_timer_type) { | 193 : test_timer_type_(test_timer_type) { |
| 194 gpu_timing_.SetCpuTimeForTesting(base::Bind(&FakeCpuTime)); | |
| 195 gpu_timing_.SetTimerTypeForTesting(test_timer_type); | |
| 196 } | 194 } |
| 197 | 195 |
| 198 protected: | 196 protected: |
| 199 void SetUp() override { | 197 void SetUp() override { |
| 200 g_fakeCPUTime = 0; | 198 g_fakeCPUTime = 0; |
| 201 const char* gl_version = "3.2"; | 199 const char* gl_version = "3.2"; |
| 202 const char* extensions = ""; | 200 const char* extensions = ""; |
| 203 if (GetTimerType() == GPUTiming::kTimerTypeDisjoint) { | 201 if (GetTimerType() == gfx::GPUTiming::kTimerTypeDisjoint) { |
| 204 gl_version = "opengl es 3.0"; | 202 gl_version = "opengl es 3.0"; |
| 205 extensions = "GL_EXT_disjoint_timer_query"; | 203 extensions = "GL_EXT_disjoint_timer_query"; |
| 206 } else if (GetTimerType() == GPUTiming::kTimerTypeARB) { | 204 } else if (GetTimerType() == gfx::GPUTiming::kTimerTypeARB) { |
| 207 // TODO(sievers): The tracer should not depend on ARB_occlusion_query. | 205 // TODO(sievers): The tracer should not depend on ARB_occlusion_query. |
| 208 // Try merge Query APIs (core, ARB, EXT) into a single binding each. | 206 // Try merge Query APIs (core, ARB, EXT) into a single binding each. |
| 209 extensions = "GL_ARB_timer_query GL_ARB_occlusion_query"; | 207 extensions = "GL_ARB_timer_query GL_ARB_occlusion_query"; |
| 210 } | 208 } |
| 211 GpuServiceTest::SetUpWithGLVersion(gl_version, extensions); | 209 GpuServiceTest::SetUpWithGLVersion(gl_version, extensions); |
| 210 gpu_timing_client_ = GetGLContext()->CreateGPUTimingClient(); |
| 211 gpu_timing_client_->SetCpuTimeForTesting(base::Bind(&FakeCpuTime)); |
| 212 gl_fake_queries_.Reset(); | 212 gl_fake_queries_.Reset(); |
| 213 | 213 |
| 214 outputter_ref_ = new MockOutputter(); | 214 outputter_ref_ = new MockOutputter(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void TearDown() override { | 217 void TearDown() override { |
| 218 outputter_ref_ = NULL; | 218 outputter_ref_ = NULL; |
| 219 | 219 |
| 220 gl_fake_queries_.Reset(); | 220 gl_fake_queries_.Reset(); |
| 221 GpuServiceTest::TearDown(); | 221 GpuServiceTest::TearDown(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void ExpectTraceQueryMocks() { | 224 void ExpectTraceQueryMocks() { |
| 225 if (GetTimerType() != GPUTiming::kTimerTypeInvalid) { | 225 if (GetTimerType() != gfx::GPUTiming::kTimerTypeInvalid) { |
| 226 // Delegate query APIs used by GPUTrace to a GlFakeQueries | 226 // Delegate query APIs used by GPUTrace to a GlFakeQueries |
| 227 EXPECT_CALL(*gl_, GenQueriesARB(2, NotNull())).Times(AtLeast(1)) | 227 EXPECT_CALL(*gl_, GenQueriesARB(2, NotNull())).Times(AtLeast(1)) |
| 228 .WillRepeatedly( | 228 .WillRepeatedly( |
| 229 Invoke(&gl_fake_queries_, &GlFakeQueries::GenQueriesARB)); | 229 Invoke(&gl_fake_queries_, &GlFakeQueries::GenQueriesARB)); |
| 230 | 230 |
| 231 EXPECT_CALL(*gl_, GetQueryObjectivARB(_, GL_QUERY_RESULT_AVAILABLE, | 231 EXPECT_CALL(*gl_, GetQueryObjectivARB(_, GL_QUERY_RESULT_AVAILABLE, |
| 232 NotNull())) | 232 NotNull())) |
| 233 .WillRepeatedly( | 233 .WillRepeatedly( |
| 234 Invoke(&gl_fake_queries_, &GlFakeQueries::GetQueryObjectivARB)); | 234 Invoke(&gl_fake_queries_, &GlFakeQueries::GetQueryObjectivARB)); |
| 235 | 235 |
| 236 if (GetTimerType() == GPUTiming::kTimerTypeDisjoint) { | 236 EXPECT_CALL(*gl_, GetInteger64v(GL_TIMESTAMP, _)) |
| 237 EXPECT_CALL(*gl_, GetInteger64v(GL_TIMESTAMP, _)) | |
| 238 .WillRepeatedly( | 237 .WillRepeatedly( |
| 239 Invoke(&gl_fake_queries_, &GlFakeQueries::GetInteger64v)); | 238 Invoke(&gl_fake_queries_, &GlFakeQueries::GetInteger64v)); |
| 240 } | |
| 241 | 239 |
| 242 EXPECT_CALL(*gl_, QueryCounter(_, GL_TIMESTAMP)).Times(AtLeast(2)) | 240 EXPECT_CALL(*gl_, QueryCounter(_, GL_TIMESTAMP)).Times(AtLeast(2)) |
| 243 .WillRepeatedly( | 241 .WillRepeatedly( |
| 244 Invoke(&gl_fake_queries_, &GlFakeQueries::QueryCounter)); | 242 Invoke(&gl_fake_queries_, &GlFakeQueries::QueryCounter)); |
| 245 | 243 |
| 246 EXPECT_CALL(*gl_, GetQueryObjectui64v(_, GL_QUERY_RESULT, NotNull())) | 244 EXPECT_CALL(*gl_, GetQueryObjectui64v(_, GL_QUERY_RESULT, NotNull())) |
| 247 .WillRepeatedly( | 245 .WillRepeatedly( |
| 248 Invoke(&gl_fake_queries_, | 246 Invoke(&gl_fake_queries_, |
| 249 &GlFakeQueries::GetQueryObjectui64v)); | 247 &GlFakeQueries::GetQueryObjectui64v)); |
| 250 | 248 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 279 expect_start_time, expect_end_time)) | 277 expect_start_time, expect_end_time)) |
| 280 .Times(Exactly(0)); | 278 .Times(Exactly(0)); |
| 281 } | 279 } |
| 282 } | 280 } |
| 283 | 281 |
| 284 void ExpectOutputterMocks(MockOutputter* outputter, | 282 void ExpectOutputterMocks(MockOutputter* outputter, |
| 285 const std::string& category, | 283 const std::string& category, |
| 286 const std::string& name, int64 expect_start_time, | 284 const std::string& name, int64 expect_start_time, |
| 287 int64 expect_end_time) { | 285 int64 expect_end_time) { |
| 288 ExpectOutputterBeginMocks(outputter, category, name); | 286 ExpectOutputterBeginMocks(outputter, category, name); |
| 287 bool valid_timer = GetTimerType() != gfx::GPUTiming::kTimerTypeInvalid; |
| 289 ExpectOutputterEndMocks(outputter, category, name, expect_start_time, | 288 ExpectOutputterEndMocks(outputter, category, name, expect_start_time, |
| 290 expect_end_time, | 289 expect_end_time, valid_timer); |
| 291 GetTimerType() != GPUTiming::kTimerTypeInvalid); | |
| 292 } | 290 } |
| 293 | 291 |
| 294 void ExpectTracerOffsetQueryMocks() { | 292 void ExpectTracerOffsetQueryMocks() { |
| 295 // Disjoint check should only be called by kTracerTypeDisjointTimer type. | 293 // Disjoint check should only be called by kTracerTypeDisjointTimer type. |
| 296 if (GetTimerType() == GPUTiming::kTimerTypeDisjoint) { | 294 if (GetTimerType() == gfx::GPUTiming::kTimerTypeDisjoint) { |
| 297 EXPECT_CALL(*gl_, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(AtLeast(1)) | 295 EXPECT_CALL(*gl_, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(AtLeast(1)) |
| 298 .WillRepeatedly( | 296 .WillRepeatedly( |
| 299 Invoke(&gl_fake_queries_, &GlFakeQueries::GetIntegerv)); | 297 Invoke(&gl_fake_queries_, &GlFakeQueries::GetIntegerv)); |
| 300 } else { | 298 } else { |
| 301 EXPECT_CALL(*gl_, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(Exactly(0)); | 299 EXPECT_CALL(*gl_, GetIntegerv(GL_GPU_DISJOINT_EXT, _)).Times(Exactly(0)); |
| 302 } | 300 } |
| 303 | 301 |
| 304 if (GetTimerType() != GPUTiming::kTimerTypeARB) { | 302 if (GetTimerType() != gfx::GPUTiming::kTimerTypeARB) { |
| 305 EXPECT_CALL(*gl_, GetInteger64v(GL_TIMESTAMP, NotNull())) | 303 EXPECT_CALL(*gl_, GetInteger64v(GL_TIMESTAMP, NotNull())) |
| 306 .Times(Exactly(0)); | 304 .Times(Exactly(0)); |
| 307 } else { | 305 } else { |
| 308 EXPECT_CALL(*gl_, GetInteger64v(GL_TIMESTAMP, NotNull())) | 306 EXPECT_CALL(*gl_, GetInteger64v(GL_TIMESTAMP, NotNull())) |
| 309 .Times(AtMost(1)) | 307 .Times(AtMost(1)) |
| 310 .WillRepeatedly( | 308 .WillRepeatedly( |
| 311 Invoke(&gl_fake_queries_, &GlFakeQueries::GetInteger64v)); | 309 Invoke(&gl_fake_queries_, &GlFakeQueries::GetInteger64v)); |
| 312 } | 310 } |
| 313 } | 311 } |
| 314 | 312 |
| 315 GPUTiming::TimerType GetTimerType() { return test_timer_type_; } | 313 gfx::GPUTiming::TimerType GetTimerType() { return test_timer_type_; } |
| 316 | 314 |
| 317 GPUTiming::TimerType test_timer_type_; | 315 gfx::GPUTiming::TimerType test_timer_type_; |
| 318 GlFakeQueries gl_fake_queries_; | 316 GlFakeQueries gl_fake_queries_; |
| 319 | 317 |
| 320 GPUTiming gpu_timing_; | 318 scoped_refptr<gfx::GPUTimingClient> gpu_timing_client_; |
| 321 scoped_refptr<MockOutputter> outputter_ref_; | 319 scoped_refptr<MockOutputter> outputter_ref_; |
| 322 }; | 320 }; |
| 323 | 321 |
| 324 // Test GPUTrace calls all the correct gl calls. | 322 // Test GPUTrace calls all the correct gl calls. |
| 325 class BaseGpuTraceTest : public BaseGpuTest { | 323 class BaseGpuTraceTest : public BaseGpuTest { |
| 326 public: | 324 public: |
| 327 explicit BaseGpuTraceTest(GPUTiming::TimerType test_timer_type) | 325 explicit BaseGpuTraceTest(gfx::GPUTiming::TimerType test_timer_type) |
| 328 : BaseGpuTest(test_timer_type) {} | 326 : BaseGpuTest(test_timer_type) {} |
| 329 | 327 |
| 330 void DoTraceTest() { | 328 void DoTraceTest() { |
| 331 // Expected results | 329 // Expected results |
| 332 const std::string category_name("trace_category"); | 330 const std::string category_name("trace_category"); |
| 333 const std::string trace_name("trace_test"); | 331 const std::string trace_name("trace_test"); |
| 334 const int64 offset_time = 3231; | 332 const int64 offset_time = 3231; |
| 335 const GLint64 start_timestamp = 7 * base::Time::kNanosecondsPerMicrosecond; | 333 const GLint64 start_timestamp = 7 * base::Time::kNanosecondsPerMicrosecond; |
| 336 const GLint64 end_timestamp = 32 * base::Time::kNanosecondsPerMicrosecond; | 334 const GLint64 end_timestamp = 32 * base::Time::kNanosecondsPerMicrosecond; |
| 337 const int64 expect_start_time = | 335 const int64 expect_start_time = |
| 338 (start_timestamp / base::Time::kNanosecondsPerMicrosecond) + | 336 (start_timestamp / base::Time::kNanosecondsPerMicrosecond) + |
| 339 offset_time; | 337 offset_time; |
| 340 const int64 expect_end_time = | 338 const int64 expect_end_time = |
| 341 (end_timestamp / base::Time::kNanosecondsPerMicrosecond) + offset_time; | 339 (end_timestamp / base::Time::kNanosecondsPerMicrosecond) + offset_time; |
| 342 | 340 |
| 343 ExpectTraceQueryMocks(); | 341 ExpectTraceQueryMocks(); |
| 344 ExpectOutputterMocks(outputter_ref_.get(), category_name, trace_name, | 342 ExpectOutputterMocks(outputter_ref_.get(), category_name, trace_name, |
| 345 expect_start_time, expect_end_time); | 343 expect_start_time, expect_end_time); |
| 346 | 344 |
| 347 scoped_refptr<GPUTrace> trace = new GPUTrace( | 345 scoped_refptr<GPUTrace> trace = new GPUTrace( |
| 348 outputter_ref_, &gpu_timing_, category_name, trace_name, true); | 346 outputter_ref_, gpu_timing_client_.get(), |
| 349 | 347 category_name, trace_name, true); |
| 350 gpu_timing_.SetOffsetForTesting( | |
| 351 offset_time, test_timer_type_ == GPUTiming::kTimerTypeARB); | |
| 352 | 348 |
| 353 gl_fake_queries_.SetCurrentGLTime(start_timestamp); | 349 gl_fake_queries_.SetCurrentGLTime(start_timestamp); |
| 354 g_fakeCPUTime = expect_start_time; | 350 g_fakeCPUTime = expect_start_time; |
| 355 trace->Start(true); | 351 trace->Start(true); |
| 356 | 352 |
| 357 // Shouldn't be available before End() call | 353 // Shouldn't be available before End() call |
| 358 gl_fake_queries_.SetCurrentGLTime(end_timestamp); | 354 gl_fake_queries_.SetCurrentGLTime(end_timestamp); |
| 359 g_fakeCPUTime = expect_end_time; | 355 g_fakeCPUTime = expect_end_time; |
| 360 EXPECT_FALSE(trace->IsAvailable()); | 356 EXPECT_FALSE(trace->IsAvailable()); |
| 361 | 357 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 372 | 368 |
| 373 // Proces should output expected Trace results to MockOutputter | 369 // Proces should output expected Trace results to MockOutputter |
| 374 trace->Process(); | 370 trace->Process(); |
| 375 | 371 |
| 376 outputter_ref_ = NULL; | 372 outputter_ref_ = NULL; |
| 377 } | 373 } |
| 378 }; | 374 }; |
| 379 | 375 |
| 380 class GpuARBTimerTraceTest : public BaseGpuTraceTest { | 376 class GpuARBTimerTraceTest : public BaseGpuTraceTest { |
| 381 public: | 377 public: |
| 382 GpuARBTimerTraceTest() : BaseGpuTraceTest(GPUTiming::kTimerTypeARB) {} | 378 GpuARBTimerTraceTest() : BaseGpuTraceTest(gfx::GPUTiming::kTimerTypeARB) {} |
| 383 }; | 379 }; |
| 384 | 380 |
| 385 class GpuDisjointTimerTraceTest : public BaseGpuTraceTest { | 381 class GpuDisjointTimerTraceTest : public BaseGpuTraceTest { |
| 386 public: | 382 public: |
| 387 GpuDisjointTimerTraceTest() | 383 GpuDisjointTimerTraceTest() |
| 388 : BaseGpuTraceTest(GPUTiming::kTimerTypeDisjoint) {} | 384 : BaseGpuTraceTest(gfx::GPUTiming::kTimerTypeDisjoint) {} |
| 389 }; | 385 }; |
| 390 | 386 |
| 391 TEST_F(GpuARBTimerTraceTest, ARBTimerTraceTest) { | 387 TEST_F(GpuARBTimerTraceTest, ARBTimerTraceTest) { |
| 392 DoTraceTest(); | 388 DoTraceTest(); |
| 393 } | 389 } |
| 394 | 390 |
| 395 TEST_F(GpuDisjointTimerTraceTest, DisjointTimerTraceTest) { | 391 TEST_F(GpuDisjointTimerTraceTest, DisjointTimerTraceTest) { |
| 396 DoTraceTest(); | 392 DoTraceTest(); |
| 397 } | 393 } |
| 398 | 394 |
| 399 // Test GPUTracer calls all the correct gl calls. | 395 // Test GPUTracer calls all the correct gl calls. |
| 400 class BaseGpuTracerTest : public BaseGpuTest { | 396 class BaseGpuTracerTest : public BaseGpuTest { |
| 401 public: | 397 public: |
| 402 explicit BaseGpuTracerTest(GPUTiming::TimerType test_timer_type) | 398 explicit BaseGpuTracerTest(gfx::GPUTiming::TimerType test_timer_type) |
| 403 : BaseGpuTest(test_timer_type) {} | 399 : BaseGpuTest(test_timer_type) {} |
| 404 | 400 |
| 405 void DoBasicTracerTest() { | 401 void DoBasicTracerTest() { |
| 406 ExpectTracerOffsetQueryMocks(); | 402 ExpectTracerOffsetQueryMocks(); |
| 407 | 403 |
| 408 MockGLES2Decoder decoder; | 404 MockGLES2Decoder decoder; |
| 409 EXPECT_CALL(decoder, GetGLContext()).WillOnce(Return(GetGLContext())); | 405 EXPECT_CALL(decoder, GetGLContext()).WillOnce(Return(GetGLContext())); |
| 410 GPUTracerTester tracer(&decoder); | 406 GPUTracerTester tracer(&decoder); |
| 411 tracer.SetTracingEnabled(true); | 407 tracer.SetTracingEnabled(true); |
| 412 | 408 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 gl_fake_queries_.SetCurrentGLTime( | 471 gl_fake_queries_.SetCurrentGLTime( |
| 476 end_timestamp + | 472 end_timestamp + |
| 477 (i * base::Time::kNanosecondsPerMicrosecond)); | 473 (i * base::Time::kNanosecondsPerMicrosecond)); |
| 478 g_fakeCPUTime = expect_end_time + i; | 474 g_fakeCPUTime = expect_end_time + i; |
| 479 | 475 |
| 480 // Each trace name should be different to differentiate. | 476 // Each trace name should be different to differentiate. |
| 481 const char num_char = static_cast<char>('0' + i); | 477 const char num_char = static_cast<char>('0' + i); |
| 482 std::string source_category = category_name + num_char; | 478 std::string source_category = category_name + num_char; |
| 483 std::string source_trace_name = trace_name + num_char; | 479 std::string source_trace_name = trace_name + num_char; |
| 484 | 480 |
| 481 bool valid_timer = GetTimerType() != gfx::GPUTiming::kTimerTypeInvalid; |
| 485 ExpectOutputterEndMocks(outputter_ref_.get(), source_category, | 482 ExpectOutputterEndMocks(outputter_ref_.get(), source_category, |
| 486 source_trace_name, expect_start_time + i, | 483 source_trace_name, expect_start_time + i, |
| 487 expect_end_time + i, | 484 expect_end_time + i, valid_timer); |
| 488 GetTimerType() != GPUTiming::kTimerTypeInvalid); | |
| 489 | 485 |
| 490 const GpuTracerSource source = static_cast<GpuTracerSource>(i); | 486 const GpuTracerSource source = static_cast<GpuTracerSource>(i); |
| 491 | 487 |
| 492 // Check if the current category/name are correct for this source. | 488 // Check if the current category/name are correct for this source. |
| 493 ASSERT_EQ(source_category, tracer.CurrentCategory(source)); | 489 ASSERT_EQ(source_category, tracer.CurrentCategory(source)); |
| 494 ASSERT_EQ(source_trace_name, tracer.CurrentName(source)); | 490 ASSERT_EQ(source_trace_name, tracer.CurrentName(source)); |
| 495 | 491 |
| 496 ASSERT_TRUE(tracer.End(source)); | 492 ASSERT_TRUE(tracer.End(source)); |
| 497 } | 493 } |
| 498 | 494 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 | 544 |
| 549 ASSERT_TRUE(tracer.End(source)); | 545 ASSERT_TRUE(tracer.End(source)); |
| 550 ASSERT_TRUE(tracer.EndDecoding()); | 546 ASSERT_TRUE(tracer.EndDecoding()); |
| 551 | 547 |
| 552 outputter_ref_ = NULL; | 548 outputter_ref_ = NULL; |
| 553 } | 549 } |
| 554 }; | 550 }; |
| 555 | 551 |
| 556 class InvalidTimerTracerTest : public BaseGpuTracerTest { | 552 class InvalidTimerTracerTest : public BaseGpuTracerTest { |
| 557 public: | 553 public: |
| 558 InvalidTimerTracerTest() : BaseGpuTracerTest(GPUTiming::kTimerTypeInvalid) {} | 554 InvalidTimerTracerTest() |
| 555 : BaseGpuTracerTest(gfx::GPUTiming::kTimerTypeInvalid) {} |
| 559 }; | 556 }; |
| 560 | 557 |
| 561 class GpuARBTimerTracerTest : public BaseGpuTracerTest { | 558 class GpuARBTimerTracerTest : public BaseGpuTracerTest { |
| 562 public: | 559 public: |
| 563 GpuARBTimerTracerTest() : BaseGpuTracerTest(GPUTiming::kTimerTypeARB) {} | 560 GpuARBTimerTracerTest() |
| 561 : BaseGpuTracerTest(gfx::GPUTiming::kTimerTypeARB) {} |
| 564 }; | 562 }; |
| 565 | 563 |
| 566 class GpuDisjointTimerTracerTest : public BaseGpuTracerTest { | 564 class GpuDisjointTimerTracerTest : public BaseGpuTracerTest { |
| 567 public: | 565 public: |
| 568 GpuDisjointTimerTracerTest() | 566 GpuDisjointTimerTracerTest() |
| 569 : BaseGpuTracerTest(GPUTiming::kTimerTypeDisjoint) {} | 567 : BaseGpuTracerTest(gfx::GPUTiming::kTimerTypeDisjoint) {} |
| 570 }; | 568 }; |
| 571 | 569 |
| 572 TEST_F(InvalidTimerTracerTest, InvalidTimerBasicTracerTest) { | 570 TEST_F(InvalidTimerTracerTest, InvalidTimerBasicTracerTest) { |
| 573 DoBasicTracerTest(); | 571 DoBasicTracerTest(); |
| 574 } | 572 } |
| 575 | 573 |
| 576 TEST_F(GpuARBTimerTracerTest, ARBTimerBasicTracerTest) { | 574 TEST_F(GpuARBTimerTracerTest, ARBTimerBasicTracerTest) { |
| 577 DoBasicTracerTest(); | 575 DoBasicTracerTest(); |
| 578 } | 576 } |
| 579 | 577 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 | 638 |
| 641 ASSERT_TRUE(tracer_tester_->BeginDecoding()); | 639 ASSERT_TRUE(tracer_tester_->BeginDecoding()); |
| 642 EXPECT_TRUE( | 640 EXPECT_TRUE( |
| 643 tracer_tester_->Begin(category_name, trace_name, kTraceGroupMarker)); | 641 tracer_tester_->Begin(category_name, trace_name, kTraceGroupMarker)); |
| 644 ASSERT_TRUE(tracer_tester_->EndDecoding()); | 642 ASSERT_TRUE(tracer_tester_->EndDecoding()); |
| 645 } | 643 } |
| 646 | 644 |
| 647 } // namespace | 645 } // namespace |
| 648 } // namespace gles2 | 646 } // namespace gles2 |
| 649 } // namespace gpu | 647 } // namespace gpu |
| OLD | NEW |