| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "base/trace_event/trace_event_argument.h" | 8 #include "base/trace_event/trace_event_argument.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "cc/debug/frame_timing_tracker.h" | 10 #include "cc/debug/frame_timing_tracker.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 static std::string ToString( | 16 static std::string ToString( |
| 17 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timingset) { | 17 scoped_ptr<FrameTimingTracker::CompositeTimingSet> timingset) { |
| 18 scoped_refptr<base::debug::TracedValue> value = | 18 scoped_refptr<base::trace_event::TracedValue> value = |
| 19 new base::debug::TracedValue(); | 19 new base::trace_event::TracedValue(); |
| 20 value->BeginArray("values"); | 20 value->BeginArray("values"); |
| 21 for (const auto& it : *timingset) { | 21 for (const auto& it : *timingset) { |
| 22 value->BeginDictionary(); | 22 value->BeginDictionary(); |
| 23 value->SetInteger("rect_id", it.first); | 23 value->SetInteger("rect_id", it.first); |
| 24 value->BeginArray("events"); | 24 value->BeginArray("events"); |
| 25 for (const auto& event : it.second) { | 25 for (const auto& event : it.second) { |
| 26 value->BeginDictionary(); | 26 value->BeginDictionary(); |
| 27 value->SetInteger("frame_id", event.frame_id); | 27 value->SetInteger("frame_id", event.frame_id); |
| 28 value->SetInteger("timestamp", event.timestamp.ToInternalValue()); | 28 value->SetInteger("timestamp", event.timestamp.ToInternalValue()); |
| 29 value->EndDictionary(); | 29 value->EndDictionary(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 "{\"frame_id\":2,\"timestamp\":100}," | 116 "{\"frame_id\":2,\"timestamp\":100}," |
| 117 "{\"frame_id\":1,\"timestamp\":200}],\"rect_id\":3}")); | 117 "{\"frame_id\":1,\"timestamp\":200}],\"rect_id\":3}")); |
| 118 EXPECT_NE(std::string::npos, | 118 EXPECT_NE(std::string::npos, |
| 119 result.find( | 119 result.find( |
| 120 "{\"events\":[" | 120 "{\"events\":[" |
| 121 "{\"frame_id\":3,\"timestamp\":100}],\"rect_id\":4}")); | 121 "{\"frame_id\":3,\"timestamp\":100}],\"rect_id\":4}")); |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace | 124 } // namespace |
| 125 } // namespace cc | 125 } // namespace cc |
| OLD | NEW |