Chromium Code Reviews| 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/plugin_metrics_provider.h" | 5 #include "chrome/browser/metrics/plugin_metrics_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 "1.5", true)); | 163 "1.5", true)); |
| 164 provider.SetPluginsForTesting(plugins); | 164 provider.SetPluginsForTesting(plugins); |
| 165 metrics::SystemProfileProto system_profile; | 165 metrics::SystemProfileProto system_profile; |
| 166 provider.ProvideSystemProfileMetrics(&system_profile); | 166 provider.ProvideSystemProfileMetrics(&system_profile); |
| 167 | 167 |
| 168 // Increase number of created instances which should also start a delayed | 168 // Increase number of created instances which should also start a delayed |
| 169 // task. | 169 // task. |
| 170 content::ChildProcessData child_process_data(content::PROCESS_TYPE_PLUGIN); | 170 content::ChildProcessData child_process_data(content::PROCESS_TYPE_PLUGIN); |
| 171 child_process_data.name = base::UTF8ToUTF16("p1"); | 171 child_process_data.name = base::UTF8ToUTF16("p1"); |
| 172 provider.BrowserChildProcessInstanceCreated(child_process_data); | 172 provider.BrowserChildProcessInstanceCreated(child_process_data); |
| 173 provider.BrowserChildProcessInstanceCreated(child_process_data); | |
| 174 | |
| 175 provider.BrowserChildProcessCrashed(child_process_data, 1); | |
| 176 provider.BrowserChildProcessHostDisconnected(child_process_data); | |
| 177 provider.BrowserChildProcessCrashed(child_process_data, 2); | |
|
Alexei Svitkine (slow)
2015/08/03 16:57:07
Hmm, is this a realistic scenario? Seems like if t
| |
| 173 | 178 |
| 174 // Call ProvideStabilityMetrics to check that it will force pending tasks to | 179 // Call ProvideStabilityMetrics to check that it will force pending tasks to |
| 175 // be executed immediately. | 180 // be executed immediately. |
| 176 provider.ProvideStabilityMetrics(&system_profile); | 181 provider.ProvideStabilityMetrics(&system_profile); |
| 177 | 182 |
| 178 // Check current number of instances created. | 183 // Check current number of instances created. |
| 179 const metrics::SystemProfileProto_Stability& stability = | 184 const metrics::SystemProfileProto_Stability& stability = |
| 180 system_profile.stability(); | 185 system_profile.stability(); |
| 181 EXPECT_EQ(1, stability.plugin_stability(0).instance_count()); | 186 EXPECT_EQ(2, stability.plugin_stability(0).instance_count()); |
| 187 EXPECT_EQ(3, stability.plugin_stability(0).crash_count()); | |
| 182 } | 188 } |
| OLD | NEW |