OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 ScopedCFTypeRef<CFNumberRef> cf_one( | 274 ScopedCFTypeRef<CFNumberRef> cf_one( |
275 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one)); | 275 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one)); |
276 ScopedCFTypeRef<CFNumberRef> cf_two( | 276 ScopedCFTypeRef<CFNumberRef> cf_two( |
277 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &two)); | 277 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &two)); |
278 ScopedCFTypeRef<CFNumberRef> cf_three( | 278 ScopedCFTypeRef<CFNumberRef> cf_three( |
279 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &three)); | 279 CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &three)); |
280 | 280 |
281 CFStringRef keys[] = { CFSTR("one"), CFSTR("two"), CFSTR("three") }; | 281 CFStringRef keys[] = { CFSTR("one"), CFSTR("two"), CFSTR("three") }; |
282 CFNumberRef values[] = { cf_one, cf_two, cf_three }; | 282 CFNumberRef values[] = { cf_one, cf_two, cf_three }; |
283 | 283 |
284 COMPILE_ASSERT(arraysize(keys) == arraysize(values), | 284 static_assert(arraysize(keys) == arraysize(values), |
285 keys_and_values_arraysizes_are_different); | 285 "keys and values arrays must have the same size"); |
286 | 286 |
287 ScopedCFTypeRef<CFDictionaryRef> test_dict( | 287 ScopedCFTypeRef<CFDictionaryRef> test_dict( |
288 CFDictionaryCreate(kCFAllocatorDefault, | 288 CFDictionaryCreate(kCFAllocatorDefault, |
289 reinterpret_cast<const void**>(keys), | 289 reinterpret_cast<const void**>(keys), |
290 reinterpret_cast<const void**>(values), | 290 reinterpret_cast<const void**>(values), |
291 arraysize(values), | 291 arraysize(values), |
292 &kCFCopyStringDictionaryKeyCallBacks, | 292 &kCFCopyStringDictionaryKeyCallBacks, |
293 &kCFTypeDictionaryValueCallBacks)); | 293 &kCFTypeDictionaryValueCallBacks)); |
294 | 294 |
295 // GetValueFromDictionary<>(_, _) should produce the correct | 295 // GetValueFromDictionary<>(_, _) should produce the correct |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 for (size_t i = 0; i < arraysize(nsuinteger_cases); ++i) { | 394 for (size_t i = 0; i < arraysize(nsuinteger_cases); ++i) { |
395 EXPECT_EQ(nsuinteger_cases[i].expected, | 395 EXPECT_EQ(nsuinteger_cases[i].expected, |
396 StringPrintf("%" PRIuNS, nsuinteger_cases[i].value)); | 396 StringPrintf("%" PRIuNS, nsuinteger_cases[i].value)); |
397 EXPECT_EQ(nsuinteger_cases[i].expected_hex, | 397 EXPECT_EQ(nsuinteger_cases[i].expected_hex, |
398 StringPrintf("%" PRIxNS, nsuinteger_cases[i].value)); | 398 StringPrintf("%" PRIxNS, nsuinteger_cases[i].value)); |
399 } | 399 } |
400 } | 400 } |
401 | 401 |
402 } // namespace mac | 402 } // namespace mac |
403 } // namespace base | 403 } // namespace base |
OLD | NEW |