| 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 "chrome/browser/metrics/chrome_stability_metrics_provider.h" | 5 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 // Kill does not increment renderer crash count. | 85 // Kill does not increment renderer crash count. |
| 86 content::RenderProcessHost::RendererClosedDetails kill_details( | 86 content::RenderProcessHost::RendererClosedDetails kill_details( |
| 87 base::TERMINATION_STATUS_PROCESS_WAS_KILLED, 1); | 87 base::TERMINATION_STATUS_PROCESS_WAS_KILLED, 1); |
| 88 provider.Observe( | 88 provider.Observe( |
| 89 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, | 89 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 90 content::Source<content::RenderProcessHost>(&host), | 90 content::Source<content::RenderProcessHost>(&host), |
| 91 content::Details<content::RenderProcessHost::RendererClosedDetails>( | 91 content::Details<content::RenderProcessHost::RendererClosedDetails>( |
| 92 &kill_details)); | 92 &kill_details)); |
| 93 | 93 |
| 94 // Failed launch increments crash count. |
| 95 content::RenderProcessHost::RendererClosedDetails failed_launch_details( |
| 96 base::TERMINATION_STATUS_LAUNCH_FAILED, 1); |
| 97 provider.Observe( |
| 98 content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| 99 content::Source<content::RenderProcessHost>(&host), |
| 100 content::Details<content::RenderProcessHost::RendererClosedDetails>( |
| 101 &failed_launch_details)); |
| 102 |
| 94 metrics::SystemProfileProto system_profile; | 103 metrics::SystemProfileProto system_profile; |
| 95 | 104 |
| 96 // Call ProvideStabilityMetrics to check that it will force pending tasks to | 105 // Call ProvideStabilityMetrics to check that it will force pending tasks to |
| 97 // be executed immediately. | 106 // be executed immediately. |
| 98 provider.ProvideStabilityMetrics(&system_profile); | 107 provider.ProvideStabilityMetrics(&system_profile); |
| 99 | 108 |
| 100 const metrics::SystemProfileProto_Stability& stability = | 109 const metrics::SystemProfileProto_Stability& stability = |
| 101 system_profile.stability(); | 110 system_profile.stability(); |
| 102 | 111 |
| 103 EXPECT_EQ(2, stability.renderer_crash_count()); | 112 EXPECT_EQ(3, stability.renderer_crash_count()); |
| 104 } | 113 } |
| OLD | NEW |