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

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

Issue 509723002: Added support for GPU Tracing on mobile devices which support it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test Created 6 years, 3 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 "gpu/command_buffer/service/gpu_service_test.h" 8 #include "gpu/command_buffer/service/gpu_service_test.h"
9 #include "gpu/command_buffer/service/gpu_tracer.h" 9 #include "gpu/command_buffer/service/gpu_tracer.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 (start_timestamp / base::Time::kNanosecondsPerMicrosecond) + 173 (start_timestamp / base::Time::kNanosecondsPerMicrosecond) +
174 offset_time; 174 offset_time;
175 const int64 expect_end_time = 175 const int64 expect_end_time =
176 (end_timestamp / base::Time::kNanosecondsPerMicrosecond) + offset_time; 176 (end_timestamp / base::Time::kNanosecondsPerMicrosecond) + offset_time;
177 177
178 // Expected Outputter::Trace call 178 // Expected Outputter::Trace call
179 EXPECT_CALL(*outputter, 179 EXPECT_CALL(*outputter,
180 Trace(trace_name, expect_start_time, expect_end_time)); 180 Trace(trace_name, expect_start_time, expect_end_time));
181 181
182 scoped_refptr<GPUTrace> trace = 182 scoped_refptr<GPUTrace> trace =
183 new GPUTrace(outputter_ref, trace_name, offset_time); 183 new GPUTrace(outputter_ref, trace_name, offset_time,
184 kTracerTypeARBTimer);
184 185
185 gl_fake_queries_.SetCurrentGLTime(start_timestamp); 186 gl_fake_queries_.SetCurrentGLTime(start_timestamp);
186 trace->Start(); 187 trace->Start();
187 188
188 // Shouldn't be available before End() call 189 // Shouldn't be available before End() call
189 gl_fake_queries_.SetCurrentGLTime(end_timestamp); 190 gl_fake_queries_.SetCurrentGLTime(end_timestamp);
190 EXPECT_FALSE(trace->IsAvailable()); 191 EXPECT_FALSE(trace->IsAvailable());
191 192
192 trace->End(); 193 trace->End();
193 194
194 // Shouldn't be available until the queries complete 195 // Shouldn't be available until the queries complete
195 gl_fake_queries_.SetCurrentGLTime(end_timestamp - 196 gl_fake_queries_.SetCurrentGLTime(end_timestamp -
196 base::Time::kNanosecondsPerMicrosecond); 197 base::Time::kNanosecondsPerMicrosecond);
197 EXPECT_FALSE(trace->IsAvailable()); 198 EXPECT_FALSE(trace->IsAvailable());
198 199
199 // Now it should be available 200 // Now it should be available
200 gl_fake_queries_.SetCurrentGLTime(end_timestamp); 201 gl_fake_queries_.SetCurrentGLTime(end_timestamp);
201 EXPECT_TRUE(trace->IsAvailable()); 202 EXPECT_TRUE(trace->IsAvailable());
202 203
203 // Proces should output expected Trace results to MockOutputter 204 // Proces should output expected Trace results to MockOutputter
204 trace->Process(); 205 trace->Process();
205 } 206 }
206 } 207 }
207 208
208 } // namespace gles2 209 } // namespace gles2
209 } // namespace gpu 210 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698