summaryrefslogtreecommitdiffstats
path: root/base/mac_util_unittest.mm
diff options
context:
space:
mode:
Diffstat (limited to 'base/mac_util_unittest.mm')
-rw-r--r--base/mac_util_unittest.mm17
1 files changed, 17 insertions, 0 deletions
diff --git a/base/mac_util_unittest.mm b/base/mac_util_unittest.mm
index 5e97356..9e56358 100644
--- a/base/mac_util_unittest.mm
+++ b/base/mac_util_unittest.mm
@@ -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 @@ TEST_F(MacUtilTest, TestExcludeFileFromBackups) {
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()));
+}