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

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

Issue 9346013: Publish app shortcuts on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 10 months 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
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 #include "base/mac/foundation_util.h" 5 #include "base/mac/foundation_util.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_path.h"
8 #include "base/mac/scoped_cftyperef.h" 9 #include "base/mac/scoped_cftyperef.h"
9 #include "base/mac/scoped_nsautorelease_pool.h" 10 #include "base/mac/scoped_nsautorelease_pool.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #import "testing/gtest_mac.h"
11 13
12 TEST(FoundationUtilTest, CFCast) { 14 TEST(FoundationUtilTest, CFCast) {
13 // Build out the CF types to be tested as empty containers. 15 // Build out the CF types to be tested as empty containers.
14 base::mac::ScopedCFTypeRef<CFTypeRef> test_array( 16 base::mac::ScopedCFTypeRef<CFTypeRef> test_array(
15 CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks)); 17 CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks));
16 base::mac::ScopedCFTypeRef<CFTypeRef> test_array_mutable( 18 base::mac::ScopedCFTypeRef<CFTypeRef> test_array_mutable(
17 CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks)); 19 CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks));
18 base::mac::ScopedCFTypeRef<CFTypeRef> test_bag( 20 base::mac::ScopedCFTypeRef<CFTypeRef> test_bag(
19 CFBagCreate(NULL, NULL, 0, &kCFTypeBagCallBacks)); 21 CFBagCreate(NULL, NULL, 0, &kCFTypeBagCallBacks));
20 base::mac::ScopedCFTypeRef<CFTypeRef> test_bag_mutable( 22 base::mac::ScopedCFTypeRef<CFTypeRef> test_bag_mutable(
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 EXPECT_EQ(values[2], 314 EXPECT_EQ(values[2],
313 base::mac::GetValueFromDictionary<CFNumberRef>(test_dict, 315 base::mac::GetValueFromDictionary<CFNumberRef>(test_dict,
314 CFSTR("three"))); 316 CFSTR("three")));
315 317
316 // Bad input should produce bad output. 318 // Bad input should produce bad output.
317 EXPECT_FALSE(base::mac::GetValueFromDictionary<CFNumberRef>(test_dict, 319 EXPECT_FALSE(base::mac::GetValueFromDictionary<CFNumberRef>(test_dict,
318 CFSTR("four"))); 320 CFSTR("four")));
319 EXPECT_FALSE(base::mac::GetValueFromDictionary<CFStringRef>(test_dict, 321 EXPECT_FALSE(base::mac::GetValueFromDictionary<CFStringRef>(test_dict,
320 CFSTR("one"))); 322 CFSTR("one")));
321 } 323 }
324
325 TEST(FoundationUtilTest, FilePathToNSString) {
326 EXPECT_NSEQ(nil, base::mac::FilePathToNSString(FilePath()));
327 EXPECT_NSEQ(@"/a/b", base::mac::FilePathToNSString(FilePath("/a/b")));
328 }
329
330 TEST(FoundationUtilTest, NSStringToFilePath) {
331 EXPECT_EQ(FilePath(), base::mac::NSStringToFilePath(nil));
332 EXPECT_EQ(FilePath(), base::mac::NSStringToFilePath(@""));
333 EXPECT_EQ(FilePath("/a/b"), base::mac::NSStringToFilePath(@"/a/b"));
334 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698