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

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: Created 8 years, 5 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
« base/ios/device_util.mm ('K') | « 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
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
OLDNEW
« base/ios/device_util.mm ('K') | « base/ios/device_util.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698