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

Side by Side Diff: base/mac_util_unittest.mm

Issue 463028: Separate ProxyResolverMac and ProxyConfigServiceMac into their own files (Closed)
Patch Set: '' Created 11 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
« no previous file with comments | « base/mac_util.mm ('k') | net/net.gyp » ('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) 2008-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008-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 #include <vector> 6 #include <vector>
7 7
8 #include "base/mac_util.h" 8 #include "base/mac_util.h"
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/scoped_cftyperef.h"
12 #include "base/scoped_nsobject.h" 13 #include "base/scoped_nsobject.h"
13 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "testing/platform_test.h" 16 #include "testing/platform_test.h"
16 17
17 typedef PlatformTest MacUtilTest; 18 typedef PlatformTest MacUtilTest;
18 19
19 TEST_F(MacUtilTest, TestFSRef) { 20 TEST_F(MacUtilTest, TestFSRef) {
20 FSRef ref; 21 FSRef ref;
21 std::string path("/System/Library"); 22 std::string path("/System/Library");
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 Boolean excludeByPath; 119 Boolean excludeByPath;
119 // Initial state should be non-excluded. 120 // Initial state should be non-excluded.
120 EXPECT_FALSE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath)); 121 EXPECT_FALSE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath));
121 // Exclude the file. 122 // Exclude the file.
122 EXPECT_TRUE(mac_util::SetFileBackupExclusion(file_path, true)); 123 EXPECT_TRUE(mac_util::SetFileBackupExclusion(file_path, true));
123 EXPECT_TRUE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath)); 124 EXPECT_TRUE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath));
124 // Un-exclude the file. 125 // Un-exclude the file.
125 EXPECT_TRUE(mac_util::SetFileBackupExclusion(file_path, false)); 126 EXPECT_TRUE(mac_util::SetFileBackupExclusion(file_path, false));
126 EXPECT_FALSE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath)); 127 EXPECT_FALSE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath));
127 } 128 }
129
130 TEST_F(MacUtilTest, TestGetValueFromDictionary) {
131 scoped_cftyperef<CFMutableDictionaryRef> dict(
132 CFDictionaryCreateMutable(0, 0,
133 &kCFTypeDictionaryKeyCallBacks,
134 &kCFTypeDictionaryValueCallBacks));
135 CFDictionarySetValue(dict.get(), CFSTR("key"), CFSTR("value"));
136
137 EXPECT_TRUE(CFEqual(CFSTR("value"),
138 mac_util::GetValueFromDictionary(
139 dict, CFSTR("key"), CFStringGetTypeID())));
140 EXPECT_FALSE(mac_util::GetValueFromDictionary(
141 dict, CFSTR("key"), CFNumberGetTypeID()));
142 EXPECT_FALSE(mac_util::GetValueFromDictionary(
143 dict, CFSTR("no-exist"), CFStringGetTypeID()));
144 }
OLDNEW
« no previous file with comments | « base/mac_util.mm ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698