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(ios::device_util::platform()); | |
stuartmorgan
2012/07/24 13:38:49
s/platformStr/platform/
| |
22 GTEST_ASSERT_GT([platformStr length], 0U); | |
23 } | |
24 | |
25 TEST_F(DeviceUtilTest, IsRunningOnHighRamDevice) { | |
26 // The true/false here depends on what it is run on, so there isn't | |
27 // really a way to unittest it. Just run the api to make sure it | |
28 // doesn't choke. | |
29 (void)ios::device_util::isRunningOnHighRamDevice(); | |
30 } | |
31 | |
32 TEST_F(DeviceUtilTest, DeviceIdentifier) { | |
33 NSString* default_id = | |
34 base::SysUTF8ToNSString(ios::device_util::deviceIdentifier(NULL)); | |
35 NSString* other_id = | |
36 base::SysUTF8ToNSString(ios::device_util::deviceIdentifier("ForTest")); | |
37 EXPECT_NSNE(default_id, other_id); | |
38 | |
39 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | |
40 [defaults removeObjectForKey:@"ChromiumClientID"]; | |
41 [defaults synchronize]; | |
42 | |
43 NSString* new_default_id = | |
44 base::SysUTF8ToNSString(ios::device_util::deviceIdentifier(NULL)); | |
45 EXPECT_NSNE(default_id, new_default_id); | |
46 } | |
47 | |
48 } // anonymous namespace | |
OLD | NEW |