Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1890)

Side by Side Diff: gpu/command_buffer/service/gpu_tracer_unittest.cc

Issue 1132283003: Merge Group Markers into Chromium Traces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make SwapBuffers use the GLES2Decoder GL_Category Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/gpu_tracer.cc ('k') | ppapi/shared_impl/ppb_graphics_3d_shared.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" 6 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
7 #include "gpu/command_buffer/service/gpu_service_test.h" 7 #include "gpu/command_buffer/service/gpu_service_test.h"
8 #include "gpu/command_buffer/service/gpu_tracer.h" 8 #include "gpu/command_buffer/service/gpu_tracer.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gl/gl_context.h" 10 #include "ui/gl/gl_context.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 }; 220 };
221 221
222 // Test GPUTrace calls all the correct gl calls. 222 // Test GPUTrace calls all the correct gl calls.
223 class BaseGpuTraceTest : public BaseGpuTest { 223 class BaseGpuTraceTest : public BaseGpuTest {
224 public: 224 public:
225 explicit BaseGpuTraceTest(gfx::GPUTiming::TimerType test_timer_type) 225 explicit BaseGpuTraceTest(gfx::GPUTiming::TimerType test_timer_type)
226 : BaseGpuTest(test_timer_type) {} 226 : BaseGpuTest(test_timer_type) {}
227 227
228 void DoTraceTest(bool tracing_service, bool tracing_device) { 228 void DoTraceTest(bool tracing_service, bool tracing_device) {
229 // Expected results 229 // Expected results
230 const GpuTracerSource tracer_source = kTraceGroupMarker; 230 const GpuTracerSource tracer_source = kTraceCHROMIUM;
231 const std::string category_name("trace_category"); 231 const std::string category_name("trace_category");
232 const std::string trace_name("trace_test"); 232 const std::string trace_name("trace_test");
233 const int64 offset_time = 3231; 233 const int64 offset_time = 3231;
234 const GLint64 start_timestamp = 7 * base::Time::kNanosecondsPerMicrosecond; 234 const GLint64 start_timestamp = 7 * base::Time::kNanosecondsPerMicrosecond;
235 const GLint64 end_timestamp = 32 * base::Time::kNanosecondsPerMicrosecond; 235 const GLint64 end_timestamp = 32 * base::Time::kNanosecondsPerMicrosecond;
236 const int64 expect_start_time = 236 const int64 expect_start_time =
237 (start_timestamp / base::Time::kNanosecondsPerMicrosecond) + 237 (start_timestamp / base::Time::kNanosecondsPerMicrosecond) +
238 offset_time; 238 offset_time;
239 const int64 expect_end_time = 239 const int64 expect_end_time =
240 (end_timestamp / base::Time::kNanosecondsPerMicrosecond) + offset_time; 240 (end_timestamp / base::Time::kNanosecondsPerMicrosecond) + offset_time;
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 EXPECT_FALSE(tracer_tester_->BeginDecoding()); 759 EXPECT_FALSE(tracer_tester_->BeginDecoding());
760 ASSERT_TRUE(tracer_tester_->EndDecoding()); 760 ASSERT_TRUE(tracer_tester_->EndDecoding());
761 EXPECT_FALSE(tracer_tester_->EndDecoding()); 761 EXPECT_FALSE(tracer_tester_->EndDecoding());
762 } 762 }
763 763
764 TEST_F(GPUTracerTest, TraceDuringDecodeTest) { 764 TEST_F(GPUTracerTest, TraceDuringDecodeTest) {
765 const std::string category_name("trace_category"); 765 const std::string category_name("trace_category");
766 const std::string trace_name("trace_test"); 766 const std::string trace_name("trace_test");
767 767
768 EXPECT_FALSE( 768 EXPECT_FALSE(
769 tracer_tester_->Begin(category_name, trace_name, kTraceGroupMarker)); 769 tracer_tester_->Begin(category_name, trace_name, kTraceCHROMIUM));
770 770
771 ASSERT_TRUE(tracer_tester_->BeginDecoding()); 771 ASSERT_TRUE(tracer_tester_->BeginDecoding());
772 EXPECT_TRUE( 772 EXPECT_TRUE(
773 tracer_tester_->Begin(category_name, trace_name, kTraceGroupMarker)); 773 tracer_tester_->Begin(category_name, trace_name, kTraceCHROMIUM));
774 ASSERT_TRUE(tracer_tester_->EndDecoding()); 774 ASSERT_TRUE(tracer_tester_->EndDecoding());
775 } 775 }
776 776
777 TEST_F(GpuDisjointTimerTracerTest, MultipleClientsDisjointTest) { 777 TEST_F(GpuDisjointTimerTracerTest, MultipleClientsDisjointTest) {
778 scoped_refptr<gfx::GPUTimingClient> client1 = 778 scoped_refptr<gfx::GPUTimingClient> client1 =
779 GetGLContext()->CreateGPUTimingClient(); 779 GetGLContext()->CreateGPUTimingClient();
780 scoped_refptr<gfx::GPUTimingClient> client2 = 780 scoped_refptr<gfx::GPUTimingClient> client2 =
781 GetGLContext()->CreateGPUTimingClient(); 781 GetGLContext()->CreateGPUTimingClient();
782 782
783 // Test both clients are initialized as no errors. 783 // Test both clients are initialized as no errors.
(...skipping 17 matching lines...) Expand all
801 scoped_refptr<gfx::GPUTimingClient> client3 = 801 scoped_refptr<gfx::GPUTimingClient> client3 =
802 GetGLContext()->CreateGPUTimingClient(); 802 GetGLContext()->CreateGPUTimingClient();
803 ASSERT_TRUE(client1->CheckAndResetTimerErrors()); 803 ASSERT_TRUE(client1->CheckAndResetTimerErrors());
804 ASSERT_TRUE(client2->CheckAndResetTimerErrors()); 804 ASSERT_TRUE(client2->CheckAndResetTimerErrors());
805 ASSERT_FALSE(client3->CheckAndResetTimerErrors()); 805 ASSERT_FALSE(client3->CheckAndResetTimerErrors());
806 } 806 }
807 807
808 } // namespace 808 } // namespace
809 } // namespace gles2 809 } // namespace gles2
810 } // namespace gpu 810 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_tracer.cc ('k') | ppapi/shared_impl/ppb_graphics_3d_shared.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698