| 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" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 }; | 334 }; |
| 335 | 335 |
| 336 // Test GPUTrace calls all the correct gl calls. | 336 // Test GPUTrace calls all the correct gl calls. |
| 337 class BaseGpuTraceTest : public BaseGpuTest { | 337 class BaseGpuTraceTest : public BaseGpuTest { |
| 338 public: | 338 public: |
| 339 explicit BaseGpuTraceTest(gfx::GPUTiming::TimerType test_timer_type) | 339 explicit BaseGpuTraceTest(gfx::GPUTiming::TimerType test_timer_type) |
| 340 : BaseGpuTest(test_timer_type) {} | 340 : BaseGpuTest(test_timer_type) {} |
| 341 | 341 |
| 342 void DoTraceTest(bool tracing_service, bool tracing_device) { | 342 void DoTraceTest(bool tracing_service, bool tracing_device) { |
| 343 // Expected results | 343 // Expected results |
| 344 const GpuTracerSource tracer_source = kTraceGroupMarker; | 344 const GpuTracerSource tracer_source = kTraceCHROMIUM; |
| 345 const std::string category_name("trace_category"); | 345 const std::string category_name("trace_category"); |
| 346 const std::string trace_name("trace_test"); | 346 const std::string trace_name("trace_test"); |
| 347 const int64 offset_time = 3231; | 347 const int64 offset_time = 3231; |
| 348 const GLint64 start_timestamp = 7 * base::Time::kNanosecondsPerMicrosecond; | 348 const GLint64 start_timestamp = 7 * base::Time::kNanosecondsPerMicrosecond; |
| 349 const GLint64 end_timestamp = 32 * base::Time::kNanosecondsPerMicrosecond; | 349 const GLint64 end_timestamp = 32 * base::Time::kNanosecondsPerMicrosecond; |
| 350 const int64 expect_start_time = | 350 const int64 expect_start_time = |
| 351 (start_timestamp / base::Time::kNanosecondsPerMicrosecond) + | 351 (start_timestamp / base::Time::kNanosecondsPerMicrosecond) + |
| 352 offset_time; | 352 offset_time; |
| 353 const int64 expect_end_time = | 353 const int64 expect_end_time = |
| 354 (end_timestamp / base::Time::kNanosecondsPerMicrosecond) + offset_time; | 354 (end_timestamp / base::Time::kNanosecondsPerMicrosecond) + offset_time; |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 } | 546 } |
| 547 | 547 |
| 548 void DoDisjointTest() { | 548 void DoDisjointTest() { |
| 549 // Cause a disjoint in a middle of a trace and expect no output calls. | 549 // Cause a disjoint in a middle of a trace and expect no output calls. |
| 550 ExpectTracerOffsetQueryMocks(); | 550 ExpectTracerOffsetQueryMocks(); |
| 551 | 551 |
| 552 EXPECT_CALL(*gl_, GetError()).Times(AtLeast(0)) | 552 EXPECT_CALL(*gl_, GetError()).Times(AtLeast(0)) |
| 553 .WillRepeatedly( | 553 .WillRepeatedly( |
| 554 Invoke(&gl_fake_queries_, &GlFakeQueries::GetError)); | 554 Invoke(&gl_fake_queries_, &GlFakeQueries::GetError)); |
| 555 | 555 |
| 556 const GpuTracerSource tracer_source = kTraceGroupMarker; | 556 const GpuTracerSource tracer_source = kTraceCHROMIUM; |
| 557 const std::string category_name("trace_category"); | 557 const std::string category_name("trace_category"); |
| 558 const std::string trace_name("trace_test"); | 558 const std::string trace_name("trace_test"); |
| 559 const GpuTracerSource source = static_cast<GpuTracerSource>(0); | 559 const GpuTracerSource source = static_cast<GpuTracerSource>(0); |
| 560 const int64 offset_time = 3231; | 560 const int64 offset_time = 3231; |
| 561 const GLint64 start_timestamp = 7 * base::Time::kNanosecondsPerMicrosecond; | 561 const GLint64 start_timestamp = 7 * base::Time::kNanosecondsPerMicrosecond; |
| 562 const GLint64 end_timestamp = 32 * base::Time::kNanosecondsPerMicrosecond; | 562 const GLint64 end_timestamp = 32 * base::Time::kNanosecondsPerMicrosecond; |
| 563 const int64 expect_start_time = | 563 const int64 expect_start_time = |
| 564 (start_timestamp / base::Time::kNanosecondsPerMicrosecond) + | 564 (start_timestamp / base::Time::kNanosecondsPerMicrosecond) + |
| 565 offset_time; | 565 offset_time; |
| 566 const int64 expect_end_time = | 566 const int64 expect_end_time = |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 EXPECT_FALSE(tracer_tester_->BeginDecoding()); | 700 EXPECT_FALSE(tracer_tester_->BeginDecoding()); |
| 701 ASSERT_TRUE(tracer_tester_->EndDecoding()); | 701 ASSERT_TRUE(tracer_tester_->EndDecoding()); |
| 702 EXPECT_FALSE(tracer_tester_->EndDecoding()); | 702 EXPECT_FALSE(tracer_tester_->EndDecoding()); |
| 703 } | 703 } |
| 704 | 704 |
| 705 TEST_F(GPUTracerTest, TraceDuringDecodeTest) { | 705 TEST_F(GPUTracerTest, TraceDuringDecodeTest) { |
| 706 const std::string category_name("trace_category"); | 706 const std::string category_name("trace_category"); |
| 707 const std::string trace_name("trace_test"); | 707 const std::string trace_name("trace_test"); |
| 708 | 708 |
| 709 EXPECT_FALSE( | 709 EXPECT_FALSE( |
| 710 tracer_tester_->Begin(category_name, trace_name, kTraceGroupMarker)); | 710 tracer_tester_->Begin(category_name, trace_name, kTraceCHROMIUM)); |
| 711 | 711 |
| 712 ASSERT_TRUE(tracer_tester_->BeginDecoding()); | 712 ASSERT_TRUE(tracer_tester_->BeginDecoding()); |
| 713 EXPECT_TRUE( | 713 EXPECT_TRUE( |
| 714 tracer_tester_->Begin(category_name, trace_name, kTraceGroupMarker)); | 714 tracer_tester_->Begin(category_name, trace_name, kTraceCHROMIUM)); |
| 715 ASSERT_TRUE(tracer_tester_->EndDecoding()); | 715 ASSERT_TRUE(tracer_tester_->EndDecoding()); |
| 716 } | 716 } |
| 717 | 717 |
| 718 TEST_F(GpuDisjointTimerTracerTest, MultipleClientsDisjointTest) { | 718 TEST_F(GpuDisjointTimerTracerTest, MultipleClientsDisjointTest) { |
| 719 scoped_refptr<gfx::GPUTimingClient> client1 = | 719 scoped_refptr<gfx::GPUTimingClient> client1 = |
| 720 GetGLContext()->CreateGPUTimingClient(); | 720 GetGLContext()->CreateGPUTimingClient(); |
| 721 scoped_refptr<gfx::GPUTimingClient> client2 = | 721 scoped_refptr<gfx::GPUTimingClient> client2 = |
| 722 GetGLContext()->CreateGPUTimingClient(); | 722 GetGLContext()->CreateGPUTimingClient(); |
| 723 | 723 |
| 724 // Test both clients are initialized as no errors. | 724 // Test both clients are initialized as no errors. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 742 scoped_refptr<gfx::GPUTimingClient> client3 = | 742 scoped_refptr<gfx::GPUTimingClient> client3 = |
| 743 GetGLContext()->CreateGPUTimingClient(); | 743 GetGLContext()->CreateGPUTimingClient(); |
| 744 ASSERT_TRUE(client1->CheckAndResetTimerErrors()); | 744 ASSERT_TRUE(client1->CheckAndResetTimerErrors()); |
| 745 ASSERT_TRUE(client2->CheckAndResetTimerErrors()); | 745 ASSERT_TRUE(client2->CheckAndResetTimerErrors()); |
| 746 ASSERT_FALSE(client3->CheckAndResetTimerErrors()); | 746 ASSERT_FALSE(client3->CheckAndResetTimerErrors()); |
| 747 } | 747 } |
| 748 | 748 |
| 749 } // namespace | 749 } // namespace |
| 750 } // namespace gles2 | 750 } // namespace gles2 |
| 751 } // namespace gpu | 751 } // namespace gpu |
| OLD | NEW |