OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
8 #import "chrome/browser/chrome_browser_application_mac.h" | 8 #import "chrome/browser/chrome_browser_application_mac.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 // Record some unknown exceptions. | 59 // Record some unknown exceptions. |
60 RecordExceptionWithUma(ExceptionNamed(@"CustomName")); | 60 RecordExceptionWithUma(ExceptionNamed(@"CustomName")); |
61 RecordExceptionWithUma(ExceptionNamed(@"Custom Name")); | 61 RecordExceptionWithUma(ExceptionNamed(@"Custom Name")); |
62 RecordExceptionWithUma(ExceptionNamed(@"")); | 62 RecordExceptionWithUma(ExceptionNamed(@"")); |
63 RecordExceptionWithUma(nil); | 63 RecordExceptionWithUma(nil); |
64 | 64 |
65 // We should have exactly the right number of exceptions. | 65 // We should have exactly the right number of exceptions. |
66 StatisticsRecorder::GetSnapshot("OSX.NSException", &histograms); | 66 StatisticsRecorder::GetSnapshot("OSX.NSException", &histograms); |
67 EXPECT_EQ(1U, histograms.size()); | 67 EXPECT_EQ(1U, histograms.size()); |
68 EXPECT_EQ(kUmaTargetedHistogramFlag, histograms[0]->flags()); | 68 EXPECT_EQ(Histogram::kUmaTargetedHistogramFlag, histograms[0]->flags()); |
69 Histogram::SampleSet sample; | 69 Histogram::SampleSet sample; |
70 histograms[0]->SnapshotSample(&sample); | 70 histograms[0]->SnapshotSample(&sample); |
71 EXPECT_EQ(4, sample.counts(0)); | 71 EXPECT_EQ(4, sample.counts(0)); |
72 EXPECT_EQ(1, sample.counts(1)); | 72 EXPECT_EQ(1, sample.counts(1)); |
73 EXPECT_EQ(3, sample.counts(2)); | 73 EXPECT_EQ(3, sample.counts(2)); |
74 EXPECT_EQ(2, sample.counts(3)); | 74 EXPECT_EQ(2, sample.counts(3)); |
75 | 75 |
76 // The unknown exceptions should end up in the overflow bucket. | 76 // The unknown exceptions should end up in the overflow bucket. |
77 EXPECT_EQ(kUnknownNSException + 1, histograms[0]->bucket_count()); | 77 EXPECT_EQ(kUnknownNSException + 1, histograms[0]->bucket_count()); |
78 EXPECT_EQ(4, sample.counts(kUnknownNSException)); | 78 EXPECT_EQ(4, sample.counts(kUnknownNSException)); |
79 } | 79 } |
80 | 80 |
81 } // chrome_browser_application_mac | 81 } // chrome_browser_application_mac |
OLD | NEW |