OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import <Foundation/Foundation.h> |
| 6 |
| 7 #include "base/ios/device_util.h" |
| 8 #include "base/sys_string_conversions.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "testing/gtest_mac.h" |
| 11 #include "testing/platform_test.h" |
| 12 |
| 13 namespace { |
| 14 |
| 15 typedef PlatformTest DeviceUtilTest; |
| 16 |
| 17 TEST_F(DeviceUtilTest, Platform) { |
| 18 // The result here depends on what it is run on, so there isn't |
| 19 // really a way to unittest it. Just run the api to make sure it |
| 20 // doesn't choke and returns a string with something in it. |
| 21 NSString* platformStr = base::SysUTF8ToNSString( |
| 22 ios::device_util::GetPlatform()); |
| 23 GTEST_ASSERT_GT([platformStr length], 0U); |
| 24 } |
| 25 |
| 26 TEST_F(DeviceUtilTest, IsRunningOnHighRamDevice) { |
| 27 // The true/false here depends on what it is run on, so there isn't |
| 28 // really a way to unittest it. Just run the api to make sure it |
| 29 // doesn't choke. |
| 30 (void)ios::device_util::IsRunningOnHighRamDevice(); |
| 31 } |
| 32 |
| 33 TEST_F(DeviceUtilTest, DeviceIdentifier) { |
| 34 NSString* default_id = |
| 35 base::SysUTF8ToNSString(ios::device_util::GetDeviceIdentifier(NULL)); |
| 36 NSString* other_id = |
| 37 base::SysUTF8ToNSString(ios::device_util::GetDeviceIdentifier("ForTest")); |
| 38 EXPECT_NSNE(default_id, other_id); |
| 39 |
| 40 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
| 41 [defaults removeObjectForKey:@"ChromiumClientID"]; |
| 42 [defaults synchronize]; |
| 43 |
| 44 NSString* new_default_id = |
| 45 base::SysUTF8ToNSString(ios::device_util::GetDeviceIdentifier(NULL)); |
| 46 EXPECT_NSNE(default_id, new_default_id); |
| 47 } |
| 48 |
| 49 } // anonymous namespace |
OLD | NEW |