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

Side by Side Diff: chrome/installer/mac/app/testing/SystemInfo_test.mm

Issue 2137743002: Added test files for SystemInfo.m and OmahaXMLRequest.m. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Completed both test files Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 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 #include "../SystemInfo.h"
Mark Mentovai 2016/07/15 21:56:09 #import
Anna Zeng 2016/07/22 16:58:02 Done.
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 namespace {
9
10 class SystemInfoTest : public ::testing::Test {};
Mark Mentovai 2016/07/15 21:56:09 Don’t need this at all. You haven’t used it, since
Anna Zeng 2016/07/22 16:58:02 Done.
11
12 TEST(SystemInfoTest, getArchDoesNotReturnNil) {
13 EXPECT_NE([SystemInfo getArch], nil);
Mark Mentovai 2016/07/15 21:56:09 EXPECT_TRUE is fine.
Anna Zeng 2016/07/22 16:58:02 Done.
14 }
15
16 TEST(SystemInfoTest, getArchReturnsAString) {
17 EXPECT_TRUE([[SystemInfo getArch] isKindOfClass:[NSString class]]);
18 }
19
20 TEST(SystemInfoTest, getArchReturnsAtLeastThreeCharacters) {
21 EXPECT_GE((int)[[SystemInfo getArch] length], 3);
Mark Mentovai 2016/07/15 21:56:09 You’ve got three tests where I think that one will
Anna Zeng 2016/07/22 01:45:37 So... you mean that we want the code to work ONLY
Mark Mentovai 2016/07/22 13:55:49 Remember the macro that we stuck at the top of Sys
Anna Zeng 2016/07/22 16:58:02 Done.
22 }
23
24 TEST(SystemInfoTest, getOSVersionDoesNotReturnNil) {
25 EXPECT_NE([SystemInfo getOSVersion], nil);
26 }
27
28 TEST(SystemInfoTest, getOSVersionReturnsAString) {
29 EXPECT_TRUE([[SystemInfo getOSVersion] isKindOfClass:[NSString class]]);
30 }
31
32 TEST(SystemInfoTest, getOSVersionReturnsAtLeastThreeCharacters) {
33 EXPECT_GE((int)[[SystemInfo getOSVersion] length], 3);
34 }
35
36 TEST(SystemInfoTest, getOSVersionContainsPeriodDelimiters) {
37 EXPECT_NE([[SystemInfo getOSVersion] rangeOfString:@"."
38 options:NSCaseInsensitiveSearch]
39 .location,
40 (unsigned)NSNotFound);
41 }
42
43 TEST(SystemInfoTest, getOSVersionReturnsNumbers) {
Mark Mentovai 2016/07/15 21:56:09 Similar here. Let’s just make sure that the format
Anna Zeng 2016/07/22 16:58:02 Done.
44 NSArray* substrings =
45 [[SystemInfo getOSVersion] componentsSeparatedByString:@"."];
46 for (NSString* s in substrings) {
47 EXPECT_TRUE(([s intValue] != 0) || [s isEqualToString:@"0"]);
48 }
49 }
50
51 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698