| 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 "components/metrics/profiler/tracking_synchronizer.h" | 5 #include "components/metrics/profiler/tracking_synchronizer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 using TrackingSynchronizer::SendData; | 113 using TrackingSynchronizer::SendData; |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 ~TestTrackingSynchronizer() override {} | 116 ~TestTrackingSynchronizer() override {} |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 } // namespace | 119 } // namespace |
| 120 | 120 |
| 121 TEST(TrackingSynchronizerTest, ProfilerData) { | 121 TEST(TrackingSynchronizerTest, ProfilerData) { |
| 122 // Testing how TrackingSynchronizer reports 2 phases of profiling. | 122 // Testing how TrackingSynchronizer reports 2 phases of profiling. |
| 123 auto clock = new base::SimpleTestTickClock(); // Will be owned by | 123 auto* clock = new base::SimpleTestTickClock(); // Will be owned by |
| 124 // |tracking_synchronizer|. | 124 // |tracking_synchronizer|. |
| 125 clock->Advance(base::TimeDelta::FromMilliseconds(111)); | 125 clock->Advance(base::TimeDelta::FromMilliseconds(111)); |
| 126 | 126 |
| 127 scoped_refptr<TestTrackingSynchronizer> tracking_synchronizer = | 127 scoped_refptr<TestTrackingSynchronizer> tracking_synchronizer = |
| 128 new TestTrackingSynchronizer(base::WrapUnique(clock)); | 128 new TestTrackingSynchronizer(base::WrapUnique(clock)); |
| 129 | 129 |
| 130 clock->Advance(base::TimeDelta::FromMilliseconds(222)); | 130 clock->Advance(base::TimeDelta::FromMilliseconds(222)); |
| 131 | 131 |
| 132 tracking_synchronizer->RegisterPhaseCompletion( | 132 tracking_synchronizer->RegisterPhaseCompletion( |
| 133 ProfilerEventProto::EVENT_FIRST_NONEMPTY_PAINT); | 133 ProfilerEventProto::EVENT_FIRST_NONEMPTY_PAINT); |
| 134 | 134 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 146 profiler_data.process_id = 239; | 146 profiler_data.process_id = 239; |
| 147 | 147 |
| 148 clock->Advance(base::TimeDelta::FromMilliseconds(444)); | 148 clock->Advance(base::TimeDelta::FromMilliseconds(444)); |
| 149 TestObserver test_observer; | 149 TestObserver test_observer; |
| 150 tracking_synchronizer->SendData( | 150 tracking_synchronizer->SendData( |
| 151 profiler_data, ProfilerEventProto::TrackedObject::PPAPI_PLUGIN, | 151 profiler_data, ProfilerEventProto::TrackedObject::PPAPI_PLUGIN, |
| 152 &test_observer); | 152 &test_observer); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace metrics | 155 } // namespace metrics |
| OLD | NEW |