OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
9 | 9 |
10 #import "base/chrome_application_mac.h" | 10 #import "base/chrome_application_mac.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 NSRect rect = NSZeroRect; | 173 NSRect rect = NSZeroRect; |
174 rect.size = [nsImage size]; | 174 rect.size = [nsImage size]; |
175 NSRectFill(rect); | 175 NSRectFill(rect); |
176 [nsImage unlockFocus]; | 176 [nsImage unlockFocus]; |
177 | 177 |
178 scoped_cftyperef<CGImageRef> cgImage( | 178 scoped_cftyperef<CGImageRef> cgImage( |
179 mac_util::CopyNSImageToCGImage(nsImage.get())); | 179 mac_util::CopyNSImageToCGImage(nsImage.get())); |
180 EXPECT_TRUE(cgImage.get()); | 180 EXPECT_TRUE(cgImage.get()); |
181 } | 181 } |
182 | 182 |
| 183 TEST_F(MacUtilTest, NSObjectRetainRelease) { |
| 184 scoped_nsobject<NSArray> array([[NSArray alloc] initWithObjects:@"foo", nil]); |
| 185 EXPECT_EQ(1U, [array retainCount]); |
| 186 |
| 187 mac_util::NSObjectRetain(array); |
| 188 EXPECT_EQ(2U, [array retainCount]); |
| 189 |
| 190 mac_util::NSObjectRelease(array); |
| 191 EXPECT_EQ(1U, [array retainCount]); |
| 192 } |
| 193 |
183 } // namespace | 194 } // namespace |
184 | 195 |
185 } // namespace mac_util | 196 } // namespace mac_util |
OLD | NEW |