| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 ~TestObserver() override { | 47 ~TestObserver() override { |
| 48 EXPECT_TRUE(got_phase_0_); | 48 EXPECT_TRUE(got_phase_0_); |
| 49 EXPECT_TRUE(got_phase_1_); | 49 EXPECT_TRUE(got_phase_1_); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void ReceivedProfilerData( | 52 void ReceivedProfilerData( |
| 53 const ProfilerDataAttributes& attributes, | 53 const ProfilerDataAttributes& attributes, |
| 54 const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase, | 54 const tracked_objects::ProcessDataPhaseSnapshot& process_data_phase, |
| 55 const ProfilerEvents& past_events) override { | 55 const ProfilerEvents& past_events) override { |
| 56 EXPECT_EQ(static_cast<base::ProcessId>(239), attributes.process_id); | 56 EXPECT_EQ(static_cast<base::ProcessId>(239), attributes.process_id); |
| 57 EXPECT_EQ(ProfilerEventProto::TrackedObject::PLUGIN, | 57 EXPECT_EQ(ProfilerEventProto::TrackedObject::PPAPI_PLUGIN, |
| 58 attributes.process_type); | 58 attributes.process_type); |
| 59 ASSERT_EQ(1u, process_data_phase.tasks.size()); | 59 ASSERT_EQ(1u, process_data_phase.tasks.size()); |
| 60 | 60 |
| 61 switch (attributes.profiling_phase) { | 61 switch (attributes.profiling_phase) { |
| 62 case 0: | 62 case 0: |
| 63 EXPECT_FALSE(got_phase_0_); | 63 EXPECT_FALSE(got_phase_0_); |
| 64 got_phase_0_ = true; | 64 got_phase_0_ = true; |
| 65 | 65 |
| 66 EXPECT_EQ(base::TimeTicks() + base::TimeDelta::FromMilliseconds(111), | 66 EXPECT_EQ(base::TimeTicks() + base::TimeDelta::FromMilliseconds(111), |
| 67 attributes.phase_start); | 67 attributes.phase_start); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 profiler_data.phased_snapshots[0] = snapshot0; | 140 profiler_data.phased_snapshots[0] = snapshot0; |
| 141 tracked_objects::TaskSnapshot task_snapshot1; | 141 tracked_objects::TaskSnapshot task_snapshot1; |
| 142 task_snapshot1.death_thread_name = "death_thread1"; | 142 task_snapshot1.death_thread_name = "death_thread1"; |
| 143 snapshot1.tasks.push_back(task_snapshot1); | 143 snapshot1.tasks.push_back(task_snapshot1); |
| 144 profiler_data.phased_snapshots[1] = snapshot1; | 144 profiler_data.phased_snapshots[1] = snapshot1; |
| 145 profiler_data.process_id = 239; | 145 profiler_data.process_id = 239; |
| 146 | 146 |
| 147 clock->Advance(base::TimeDelta::FromMilliseconds(444)); | 147 clock->Advance(base::TimeDelta::FromMilliseconds(444)); |
| 148 TestObserver test_observer; | 148 TestObserver test_observer; |
| 149 tracking_synchronizer->SendData( | 149 tracking_synchronizer->SendData( |
| 150 profiler_data, ProfilerEventProto::TrackedObject::PLUGIN, &test_observer); | 150 profiler_data, ProfilerEventProto::TrackedObject::PPAPI_PLUGIN, |
| 151 &test_observer); |
| 151 } | 152 } |
| 152 | 153 |
| 153 } // namespace metrics | 154 } // namespace metrics |
| OLD | NEW |