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 "ios/chrome/browser/metrics/ios_chrome_stability_metrics_provider.h" | 5 #include "ios/chrome/browser/metrics/ios_chrome_stability_metrics_provider.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "components/metrics/proto/system_profile.pb.h" | 8 #include "components/metrics/proto/system_profile.pb.h" |
9 #include "components/prefs/pref_service.h" | 9 #include "components/prefs/pref_service.h" |
10 #include "components/prefs/scoped_user_pref_update.h" | 10 #include "components/prefs/scoped_user_pref_update.h" |
11 #include "components/prefs/testing_pref_service.h" | 11 #include "components/prefs/testing_pref_service.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 class IOSChromeStabilityMetricsProviderTest : public testing::Test { | 16 class IOSChromeStabilityMetricsProviderTest : public testing::Test { |
17 protected: | 17 protected: |
18 IOSChromeStabilityMetricsProviderTest() | 18 IOSChromeStabilityMetricsProviderTest() |
19 : prefs_(new TestingPrefServiceSimple) { | 19 : prefs_(new TestingPrefServiceSimple) { |
20 metrics::StabilityMetricsHelper::RegisterPrefs(prefs()->registry()); | 20 metrics::StabilityMetricsHelper::RegisterPrefs(prefs()->registry()); |
21 } | 21 } |
22 | 22 |
23 TestingPrefServiceSimple* prefs() { return prefs_.get(); } | 23 TestingPrefServiceSimple* prefs() { return prefs_.get(); } |
24 | 24 |
25 private: | 25 private: |
26 scoped_ptr<TestingPrefServiceSimple> prefs_; | 26 std::unique_ptr<TestingPrefServiceSimple> prefs_; |
27 | 27 |
28 DISALLOW_COPY_AND_ASSIGN(IOSChromeStabilityMetricsProviderTest); | 28 DISALLOW_COPY_AND_ASSIGN(IOSChromeStabilityMetricsProviderTest); |
29 }; | 29 }; |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 TEST_F(IOSChromeStabilityMetricsProviderTest, LogLoadStart) { | 33 TEST_F(IOSChromeStabilityMetricsProviderTest, LogLoadStart) { |
34 IOSChromeStabilityMetricsProvider provider(prefs()); | 34 IOSChromeStabilityMetricsProvider provider(prefs()); |
35 | 35 |
36 // A load should not increment metrics if recording is disabled. | 36 // A load should not increment metrics if recording is disabled. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 provider.OnRecordingEnabled(); | 76 provider.OnRecordingEnabled(); |
77 provider.LogRendererCrash(); | 77 provider.LogRendererCrash(); |
78 | 78 |
79 system_profile.Clear(); | 79 system_profile.Clear(); |
80 provider.ProvideStabilityMetrics(&system_profile); | 80 provider.ProvideStabilityMetrics(&system_profile); |
81 | 81 |
82 EXPECT_EQ(1, system_profile.stability().renderer_crash_count()); | 82 EXPECT_EQ(1, system_profile.stability().renderer_crash_count()); |
83 EXPECT_EQ(0, system_profile.stability().renderer_failed_launch_count()); | 83 EXPECT_EQ(0, system_profile.stability().renderer_failed_launch_count()); |
84 EXPECT_EQ(0, system_profile.stability().extension_renderer_crash_count()); | 84 EXPECT_EQ(0, system_profile.stability().extension_renderer_crash_count()); |
85 } | 85 } |
OLD | NEW |