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 "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 8 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
9 #include "gpu/command_buffer/service/gpu_service_test.h" | 9 #include "gpu/command_buffer/service/gpu_service_test.h" |
10 #include "gpu/command_buffer/service/gpu_tracer.h" | 10 #include "gpu/command_buffer/service/gpu_tracer.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 int64 current_cpu_time_; | 43 int64 current_cpu_time_; |
44 }; | 44 }; |
45 | 45 |
46 class MockOutputter : public Outputter { | 46 class MockOutputter : public Outputter { |
47 public: | 47 public: |
48 MockOutputter() {} | 48 MockOutputter() {} |
49 MOCK_METHOD4(TraceDevice, | 49 MOCK_METHOD4(TraceDevice, |
50 void(const std::string& category, const std::string& name, | 50 void(const std::string& category, const std::string& name, |
51 int64 start_time, int64 end_time)); | 51 int64 start_time, int64 end_time)); |
52 | 52 |
53 MOCK_METHOD3(TraceServiceBegin, | 53 MOCK_METHOD2(TraceServiceBegin, |
54 void(const std::string& category, const std::string& name, | 54 void(const std::string& category, const std::string& name)); |
55 void* id)); | |
56 | 55 |
57 MOCK_METHOD3(TraceServiceEnd, | 56 MOCK_METHOD2(TraceServiceEnd, |
58 void(const std::string& category, const std::string& name, | 57 void(const std::string& category, const std::string& name)); |
59 void* id)); | |
60 | 58 |
61 protected: | 59 protected: |
62 ~MockOutputter() {} | 60 ~MockOutputter() {} |
63 }; | 61 }; |
64 | 62 |
65 class GlFakeQueries { | 63 class GlFakeQueries { |
66 public: | 64 public: |
67 GlFakeQueries() {} | 65 GlFakeQueries() {} |
68 | 66 |
69 void Reset() { | 67 void Reset() { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 EXPECT_CALL(*gl_, DeleteQueriesARB(2, NotNull())).Times(AtLeast(1)) | 278 EXPECT_CALL(*gl_, DeleteQueriesARB(2, NotNull())).Times(AtLeast(1)) |
281 .WillRepeatedly( | 279 .WillRepeatedly( |
282 Invoke(&gl_fake_queries_, &GlFakeQueries::DeleteQueriesARB)); | 280 Invoke(&gl_fake_queries_, &GlFakeQueries::DeleteQueriesARB)); |
283 } | 281 } |
284 } | 282 } |
285 | 283 |
286 void ExpectOutputterBeginMocks(MockOutputter* outputter, | 284 void ExpectOutputterBeginMocks(MockOutputter* outputter, |
287 const std::string& category, | 285 const std::string& category, |
288 const std::string& name) { | 286 const std::string& name) { |
289 EXPECT_CALL(*outputter, | 287 EXPECT_CALL(*outputter, |
290 TraceServiceBegin(category, name, NotNull())); | 288 TraceServiceBegin(category, name)); |
291 } | 289 } |
292 | 290 |
293 void ExpectOutputterEndMocks(MockOutputter* outputter, | 291 void ExpectOutputterEndMocks(MockOutputter* outputter, |
294 const std::string& category, | 292 const std::string& category, |
295 const std::string& name, int64 expect_start_time, | 293 const std::string& name, int64 expect_start_time, |
296 int64 expect_end_time, | 294 int64 expect_end_time, |
297 bool trace_device) { | 295 bool trace_device) { |
298 EXPECT_CALL(*outputter, | 296 EXPECT_CALL(*outputter, |
299 TraceServiceEnd(category, name, NotNull())); | 297 TraceServiceEnd(category, name)); |
300 | 298 |
301 if (trace_device) { | 299 if (trace_device) { |
302 EXPECT_CALL(*outputter, | 300 EXPECT_CALL(*outputter, |
303 TraceDevice(category, name, | 301 TraceDevice(category, name, |
304 expect_start_time, expect_end_time)) | 302 expect_start_time, expect_end_time)) |
305 .Times(Exactly(1)); | 303 .Times(Exactly(1)); |
306 } else { | 304 } else { |
307 EXPECT_CALL(*outputter, TraceDevice(category, name, | 305 EXPECT_CALL(*outputter, TraceDevice(category, name, |
308 expect_start_time, expect_end_time)) | 306 expect_start_time, expect_end_time)) |
309 .Times(Exactly(0)); | 307 .Times(Exactly(0)); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 kTraceGroupMarker)); | 689 kTraceGroupMarker)); |
692 | 690 |
693 ASSERT_TRUE(tracer_tester.BeginDecoding()); | 691 ASSERT_TRUE(tracer_tester.BeginDecoding()); |
694 EXPECT_TRUE(tracer_tester.Begin(category_name, trace_name, | 692 EXPECT_TRUE(tracer_tester.Begin(category_name, trace_name, |
695 kTraceGroupMarker)); | 693 kTraceGroupMarker)); |
696 ASSERT_TRUE(tracer_tester.EndDecoding()); | 694 ASSERT_TRUE(tracer_tester.EndDecoding()); |
697 } | 695 } |
698 | 696 |
699 } // namespace gles2 | 697 } // namespace gles2 |
700 } // namespace gpu | 698 } // namespace gpu |
OLD | NEW |