Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: base/ios/device_util_unittest.mm

Issue 10818023: Implements iOS device util methods. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: sync Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/ios/device_util.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 behavior of most of these utility functions depends on what they are run
15 // on, so there is not much to unittest them. The APIs are run to make sure they
16 // don't choke. Additional checks are 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
OLDNEW
« no previous file with comments | « base/ios/device_util.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698