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_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 |
11 namespace CrApplicationNSException { | 11 namespace chrome_browser_application_mac { |
12 | 12 |
13 // Generate an NSException with the given name. | 13 // Generate an NSException with the given name. |
14 NSException* ExceptionNamed(NSString* name) { | 14 NSException* ExceptionNamed(NSString* name) { |
15 return [NSException exceptionWithName:name | 15 return [NSException exceptionWithName:name |
16 reason:@"No reason given" | 16 reason:@"No reason given" |
17 userInfo:nil]; | 17 userInfo:nil]; |
18 } | 18 } |
19 | 19 |
20 // Helper to keep binning expectations readible. | 20 // Helper to keep binning expectations readible. |
21 size_t BinForExceptionNamed(NSString* name) { | 21 size_t BinForExceptionNamed(NSString* name) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } // CrApplicationNSException | 81 } // chrome_browser_application_mac |
OLD | NEW |