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 // The tests here depend on what it is run on, so there is no much to unittest | |
stuartmorgan
2012/07/30 14:28:54
s/tests here/behavior of most of these utility fun
Chen Yu
2012/07/30 16:15:45
Done.
| |
15 // it. The APIs are run to make sure they don't choke. Additional checks are | |
16 // added for particular APIs when needed. | |
17 | |
18 typedef PlatformTest DeviceUtilTest; | |
19 | |
20 TEST_F(DeviceUtilTest, GetPlatform) { | |
21 GTEST_ASSERT_GT(ios::device_util::GetPlatform().length(), 0U); | |
22 } | |
23 | |
24 TEST_F(DeviceUtilTest, IsRunningOnHighRamDevice) { | |
25 ios::device_util::IsRunningOnHighRamDevice(); | |
26 } | |
27 | |
28 TEST_F(DeviceUtilTest, IsSingleCoreDevice) { | |
29 ios::device_util::IsSingleCoreDevice(); | |
30 } | |
31 | |
32 TEST_F(DeviceUtilTest, GetMacAddress) { | |
33 GTEST_ASSERT_GT(ios::device_util::GetMacAddress("en0").length(), 0U); | |
34 } | |
35 | |
36 TEST_F(DeviceUtilTest, GetRandomId) { | |
37 GTEST_ASSERT_GT(ios::device_util::GetRandomId().length(), 0U); | |
38 } | |
39 | |
40 TEST_F(DeviceUtilTest, GetDeviceIdentifier) { | |
41 std::string default_id = ios::device_util::GetDeviceIdentifier(NULL); | |
42 std::string other_id = ios::device_util::GetDeviceIdentifier("ForTest"); | |
43 EXPECT_NE(default_id, other_id); | |
44 | |
45 NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | |
46 [defaults removeObjectForKey:@"ChromiumClientID"]; | |
47 [defaults synchronize]; | |
48 | |
49 std::string new_default_id = ios::device_util::GetDeviceIdentifier(NULL); | |
50 EXPECT_NE(default_id, new_default_id); | |
51 } | |
52 | |
53 } // namespace | |
OLD | NEW |