| 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 #import <UIKit/UIKit.h> | 5 #import <UIKit/UIKit.h> |
| 6 | 6 |
| 7 #include "base/ios/device_util.h" | 7 #include "base/ios/device_util.h" |
| 8 #include "base/ios/ios_util.h" | 8 #include "base/ios/ios_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 TEST_F(DeviceUtilTest, GetDeviceIdentifier) { | 45 TEST_F(DeviceUtilTest, GetDeviceIdentifier) { |
| 46 CleanNSUserDefaultsForDeviceId(); | 46 CleanNSUserDefaultsForDeviceId(); |
| 47 | 47 |
| 48 std::string default_id = ios::device_util::GetDeviceIdentifier(NULL); | 48 std::string default_id = ios::device_util::GetDeviceIdentifier(NULL); |
| 49 std::string other_id = ios::device_util::GetDeviceIdentifier("ForTest"); | 49 std::string other_id = ios::device_util::GetDeviceIdentifier("ForTest"); |
| 50 EXPECT_NE(default_id, other_id); | 50 EXPECT_NE(default_id, other_id); |
| 51 | 51 |
| 52 CleanNSUserDefaultsForDeviceId(); | 52 CleanNSUserDefaultsForDeviceId(); |
| 53 | 53 |
| 54 std::string new_default_id = ios::device_util::GetDeviceIdentifier(NULL); | 54 std::string new_default_id = ios::device_util::GetDeviceIdentifier(NULL); |
| 55 if (base::ios::IsRunningOnIOS6OrLater() && | 55 if (![[[[UIDevice currentDevice] identifierForVendor] UUIDString] |
| 56 ![[[[UIDevice currentDevice] identifierForVendor] UUIDString] | |
| 57 isEqualToString:@"00000000-0000-0000-0000-000000000000"]) { | 56 isEqualToString:@"00000000-0000-0000-0000-000000000000"]) { |
| 58 EXPECT_EQ(default_id, new_default_id); | 57 EXPECT_EQ(default_id, new_default_id); |
| 59 } else { | 58 } else { |
| 60 EXPECT_NE(default_id, new_default_id); | 59 EXPECT_NE(default_id, new_default_id); |
| 61 } | 60 } |
| 62 | 61 |
| 63 CleanNSUserDefaultsForDeviceId(); | 62 CleanNSUserDefaultsForDeviceId(); |
| 64 } | 63 } |
| 65 | 64 |
| 66 TEST_F(DeviceUtilTest, CheckMigration) { | 65 TEST_F(DeviceUtilTest, CheckMigration) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 std::string base_id = ios::device_util::GetDeviceIdentifier(NULL); | 135 std::string base_id = ios::device_util::GetDeviceIdentifier(NULL); |
| 137 [defaults setObject:@"Foo" forKey:@"ClientIDGenerationHardwareType"]; | 136 [defaults setObject:@"Foo" forKey:@"ClientIDGenerationHardwareType"]; |
| 138 [defaults synchronize]; | 137 [defaults synchronize]; |
| 139 std::string new_id = ios::device_util::GetDeviceIdentifier(NULL); | 138 std::string new_id = ios::device_util::GetDeviceIdentifier(NULL); |
| 140 EXPECT_NE(new_id, base_id); | 139 EXPECT_NE(new_id, base_id); |
| 141 | 140 |
| 142 CleanNSUserDefaultsForDeviceId(); | 141 CleanNSUserDefaultsForDeviceId(); |
| 143 } | 142 } |
| 144 | 143 |
| 145 } // namespace | 144 } // namespace |
| OLD | NEW |