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

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

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl Created 5 years, 9 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
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 <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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 349
350 gpu_timing_.SetOffsetForTesting( 350 gpu_timing_.SetOffsetForTesting(
351 offset_time, test_timer_type_ == GPUTiming::kTimerTypeARB); 351 offset_time, test_timer_type_ == GPUTiming::kTimerTypeARB);
352 352
353 gl_fake_queries_.SetCurrentGLTime(start_timestamp); 353 gl_fake_queries_.SetCurrentGLTime(start_timestamp);
354 g_fakeCPUTime = expect_start_time; 354 g_fakeCPUTime = expect_start_time;
355 trace->Start(true); 355 trace->Start(true);
356 356
357 // Shouldn't be available before End() call 357 // Shouldn't be available before End() call
358 gl_fake_queries_.SetCurrentGLTime(end_timestamp); 358 gl_fake_queries_.SetCurrentGLTime(end_timestamp);
359 g_fakeCPUTime = expect_end_time;
359 EXPECT_FALSE(trace->IsAvailable()); 360 EXPECT_FALSE(trace->IsAvailable());
360 361
361 trace->End(true); 362 trace->End(true);
362 363
363 // Shouldn't be available until the queries complete 364 // Shouldn't be available until the queries complete
364 gl_fake_queries_.SetCurrentGLTime(end_timestamp - 365 gl_fake_queries_.SetCurrentGLTime(end_timestamp -
365 base::Time::kNanosecondsPerMicrosecond); 366 base::Time::kNanosecondsPerMicrosecond);
366 EXPECT_FALSE(trace->IsAvailable()); 367 EXPECT_FALSE(trace->IsAvailable());
367 368
368 // Now it should be available 369 // Now it should be available
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 468
468 const GpuTracerSource source = static_cast<GpuTracerSource>(i); 469 const GpuTracerSource source = static_cast<GpuTracerSource>(i);
469 ASSERT_TRUE(tracer.Begin(source_category, source_trace_name, source)); 470 ASSERT_TRUE(tracer.Begin(source_category, source_trace_name, source));
470 } 471 }
471 472
472 for (int i = 0; i < NUM_TRACER_SOURCES; ++i) { 473 for (int i = 0; i < NUM_TRACER_SOURCES; ++i) {
473 // Set times so each source has a different time. 474 // Set times so each source has a different time.
474 gl_fake_queries_.SetCurrentGLTime( 475 gl_fake_queries_.SetCurrentGLTime(
475 end_timestamp + 476 end_timestamp +
476 (i * base::Time::kNanosecondsPerMicrosecond)); 477 (i * base::Time::kNanosecondsPerMicrosecond));
477 g_fakeCPUTime = expect_start_time + i; 478 g_fakeCPUTime = expect_end_time + i;
478 479
479 // Each trace name should be different to differentiate. 480 // Each trace name should be different to differentiate.
480 const char num_char = static_cast<char>('0' + i); 481 const char num_char = static_cast<char>('0' + i);
481 std::string source_category = category_name + num_char; 482 std::string source_category = category_name + num_char;
482 std::string source_trace_name = trace_name + num_char; 483 std::string source_trace_name = trace_name + num_char;
483 484
484 ExpectOutputterEndMocks(outputter_ref_.get(), source_category, 485 ExpectOutputterEndMocks(outputter_ref_.get(), source_category,
485 source_trace_name, expect_start_time + i, 486 source_trace_name, expect_start_time + i,
486 expect_end_time + i, 487 expect_end_time + i,
487 GetTimerType() != GPUTiming::kTimerTypeInvalid); 488 GetTimerType() != GPUTiming::kTimerTypeInvalid);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 640
640 ASSERT_TRUE(tracer_tester_->BeginDecoding()); 641 ASSERT_TRUE(tracer_tester_->BeginDecoding());
641 EXPECT_TRUE( 642 EXPECT_TRUE(
642 tracer_tester_->Begin(category_name, trace_name, kTraceGroupMarker)); 643 tracer_tester_->Begin(category_name, trace_name, kTraceGroupMarker));
643 ASSERT_TRUE(tracer_tester_->EndDecoding()); 644 ASSERT_TRUE(tracer_tester_->EndDecoding());
644 } 645 }
645 646
646 } // namespace 647 } // namespace
647 } // namespace gles2 648 } // namespace gles2
648 } // namespace gpu 649 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_tracer.cc ('k') | gpu/command_buffer/service/mailbox_manager_sync.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698