| Index: base/mac_util_unittest.mm
|
| ===================================================================
|
| --- base/mac_util_unittest.mm (revision 34241)
|
| +++ base/mac_util_unittest.mm (working copy)
|
| @@ -9,6 +9,7 @@
|
|
|
| #include "base/file_path.h"
|
| #include "base/file_util.h"
|
| +#include "base/scoped_cftyperef.h"
|
| #include "base/scoped_nsobject.h"
|
| #include "base/scoped_ptr.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -125,3 +126,19 @@
|
| EXPECT_TRUE(mac_util::SetFileBackupExclusion(file_path, false));
|
| EXPECT_FALSE(CSBackupIsItemExcluded((CFURLRef)fileURL, &excludeByPath));
|
| }
|
| +
|
| +TEST_F(MacUtilTest, TestGetValueFromDictionary) {
|
| + scoped_cftyperef<CFMutableDictionaryRef> dict(
|
| + CFDictionaryCreateMutable(0, 0,
|
| + &kCFTypeDictionaryKeyCallBacks,
|
| + &kCFTypeDictionaryValueCallBacks));
|
| + CFDictionarySetValue(dict.get(), CFSTR("key"), CFSTR("value"));
|
| +
|
| + EXPECT_TRUE(CFEqual(CFSTR("value"),
|
| + mac_util::GetValueFromDictionary(
|
| + dict, CFSTR("key"), CFStringGetTypeID())));
|
| + EXPECT_FALSE(mac_util::GetValueFromDictionary(
|
| + dict, CFSTR("key"), CFNumberGetTypeID()));
|
| + EXPECT_FALSE(mac_util::GetValueFromDictionary(
|
| + dict, CFSTR("no-exist"), CFStringGetTypeID()));
|
| +}
|
|
|