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

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

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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;
360 EXPECT_FALSE(trace->IsAvailable()); 359 EXPECT_FALSE(trace->IsAvailable());
361 360
362 trace->End(true); 361 trace->End(true);
363 362
364 // Shouldn't be available until the queries complete 363 // Shouldn't be available until the queries complete
365 gl_fake_queries_.SetCurrentGLTime(end_timestamp - 364 gl_fake_queries_.SetCurrentGLTime(end_timestamp -
366 base::Time::kNanosecondsPerMicrosecond); 365 base::Time::kNanosecondsPerMicrosecond);
367 EXPECT_FALSE(trace->IsAvailable()); 366 EXPECT_FALSE(trace->IsAvailable());
368 367
369 // Now it should be available 368 // Now it should be available
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 467
469 const GpuTracerSource source = static_cast<GpuTracerSource>(i); 468 const GpuTracerSource source = static_cast<GpuTracerSource>(i);
470 ASSERT_TRUE(tracer.Begin(source_category, source_trace_name, source)); 469 ASSERT_TRUE(tracer.Begin(source_category, source_trace_name, source));
471 } 470 }
472 471
473 for (int i = 0; i < NUM_TRACER_SOURCES; ++i) { 472 for (int i = 0; i < NUM_TRACER_SOURCES; ++i) {
474 // Set times so each source has a different time. 473 // Set times so each source has a different time.
475 gl_fake_queries_.SetCurrentGLTime( 474 gl_fake_queries_.SetCurrentGLTime(
476 end_timestamp + 475 end_timestamp +
477 (i * base::Time::kNanosecondsPerMicrosecond)); 476 (i * base::Time::kNanosecondsPerMicrosecond));
478 g_fakeCPUTime = expect_end_time + i; 477 g_fakeCPUTime = expect_start_time + i;
479 478
480 // Each trace name should be different to differentiate. 479 // Each trace name should be different to differentiate.
481 const char num_char = static_cast<char>('0' + i); 480 const char num_char = static_cast<char>('0' + i);
482 std::string source_category = category_name + num_char; 481 std::string source_category = category_name + num_char;
483 std::string source_trace_name = trace_name + num_char; 482 std::string source_trace_name = trace_name + num_char;
484 483
485 ExpectOutputterEndMocks(outputter_ref_.get(), source_category, 484 ExpectOutputterEndMocks(outputter_ref_.get(), source_category,
486 source_trace_name, expect_start_time + i, 485 source_trace_name, expect_start_time + i,
487 expect_end_time + i, 486 expect_end_time + i,
488 GetTimerType() != GPUTiming::kTimerTypeInvalid); 487 GetTimerType() != GPUTiming::kTimerTypeInvalid);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 639
641 ASSERT_TRUE(tracer_tester_->BeginDecoding()); 640 ASSERT_TRUE(tracer_tester_->BeginDecoding());
642 EXPECT_TRUE( 641 EXPECT_TRUE(
643 tracer_tester_->Begin(category_name, trace_name, kTraceGroupMarker)); 642 tracer_tester_->Begin(category_name, trace_name, kTraceGroupMarker));
644 ASSERT_TRUE(tracer_tester_->EndDecoding()); 643 ASSERT_TRUE(tracer_tester_->EndDecoding());
645 } 644 }
646 645
647 } // namespace 646 } // namespace
648 } // namespace gles2 647 } // namespace gles2
649 } // namespace gpu 648 } // 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