Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(717)

Side by Side Diff: base/mac/mac_util_unittest.mm

Issue 8769016: Use the new base::mac::GetValueFromDictionary<>() method. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update example comment Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/mac/foundation_util.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Exclude the file. 114 // Exclude the file.
115 EXPECT_TRUE(SetFileBackupExclusion(dummy_file_path)); 115 EXPECT_TRUE(SetFileBackupExclusion(dummy_file_path));
116 // SetFileBackupExclusion never excludes by path. 116 // SetFileBackupExclusion never excludes by path.
117 Boolean excluded_by_path = FALSE; 117 Boolean excluded_by_path = FALSE;
118 Boolean excluded = 118 Boolean excluded =
119 CSBackupIsItemExcluded(base::mac::NSToCFCast(fileURL), &excluded_by_path); 119 CSBackupIsItemExcluded(base::mac::NSToCFCast(fileURL), &excluded_by_path);
120 EXPECT_TRUE(excluded); 120 EXPECT_TRUE(excluded);
121 EXPECT_FALSE(excluded_by_path); 121 EXPECT_FALSE(excluded_by_path);
122 } 122 }
123 123
124 TEST_F(MacUtilTest, TestGetValueFromDictionary) {
125 ScopedCFTypeRef<CFMutableDictionaryRef> dict(
126 CFDictionaryCreateMutable(0, 0,
127 &kCFTypeDictionaryKeyCallBacks,
128 &kCFTypeDictionaryValueCallBacks));
129 CFDictionarySetValue(dict.get(), CFSTR("key"), CFSTR("value"));
130
131 EXPECT_TRUE(CFEqual(CFSTR("value"),
132 GetValueFromDictionary(
133 dict, CFSTR("key"), CFStringGetTypeID())));
134 EXPECT_FALSE(GetValueFromDictionary(dict, CFSTR("key"), CFNumberGetTypeID()));
135 EXPECT_FALSE(GetValueFromDictionary(
136 dict, CFSTR("no-exist"), CFStringGetTypeID()));
137 }
138
139 TEST_F(MacUtilTest, CopyNSImageToCGImage) { 124 TEST_F(MacUtilTest, CopyNSImageToCGImage) {
140 scoped_nsobject<NSImage> nsImage( 125 scoped_nsobject<NSImage> nsImage(
141 [[NSImage alloc] initWithSize:NSMakeSize(20, 20)]); 126 [[NSImage alloc] initWithSize:NSMakeSize(20, 20)]);
142 [nsImage lockFocus]; 127 [nsImage lockFocus];
143 [[NSColor redColor] set]; 128 [[NSColor redColor] set];
144 NSRect rect = NSZeroRect; 129 NSRect rect = NSZeroRect;
145 rect.size = [nsImage size]; 130 rect.size = [nsImage size];
146 NSRectFill(rect); 131 NSRectFill(rect);
147 [nsImage unlockFocus]; 132 [nsImage unlockFocus];
148 133
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } else { 185 } else {
201 // Not ten. What you gonna do? 186 // Not ten. What you gonna do?
202 EXPECT_FALSE(true); 187 EXPECT_FALSE(true);
203 } 188 }
204 } 189 }
205 190
206 } // namespace 191 } // namespace
207 192
208 } // namespace mac 193 } // namespace mac
209 } // namespace base 194 } // namespace base
OLDNEW
« no previous file with comments | « base/mac/foundation_util.mm ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698