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

Unified 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: Added comments & made progress on roughly half of Mark's comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/installer/mac/app/testing/SystemInfo_test.mm
diff --git a/chrome/installer/mac/app/testing/SystemInfo_test.mm b/chrome/installer/mac/app/testing/SystemInfo_test.mm
new file mode 100644
index 0000000000000000000000000000000000000000..834db258ddac714b6a256b0896f8fdd486fb13e6
--- /dev/null
+++ b/chrome/installer/mac/app/testing/SystemInfo_test.mm
@@ -0,0 +1,52 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "testing/gtest/include/gtest/gtest.h"
+
+#import "chrome/installer/mac/app/SystemInfo.h"
+
+namespace {
+
+class SystemInfoTest : public ::testing::Test {};
+
+TEST(SystemInfoTest, GetArchDoesNotReturnNil) {
+ EXPECT_TRUE([SystemInfo getArch]);
+}
+
+TEST(SystemInfoTest, GetArchReturnsAString) {
+ EXPECT_TRUE([[SystemInfo getArch] isKindOfClass:[NSString class]]);
+}
+
+TEST(SystemInfoTest, GetArchReturnsAtLeastThreeCharacters) {
+ EXPECT_GE((int)[[SystemInfo getArch] length], 3);
+}
+
+TEST(SystemInfoTest, GetOSVersionDoesNotReturnNil) {
+ EXPECT_TRUE([SystemInfo getOSVersion]);
+}
+
+TEST(SystemInfoTest, GetOSVersionReturnsAString) {
+ EXPECT_TRUE([[SystemInfo getOSVersion] isKindOfClass:[NSString class]]);
+}
+
+TEST(SystemInfoTest, GetOSVersionReturnsAtLeastThreeCharacters) {
+ EXPECT_GE((int)[[SystemInfo getOSVersion] length], 3);
+}
+
+TEST(SystemInfoTest, GetOSVersionContainsPeriodDelimiters) {
+ EXPECT_NE([[SystemInfo getOSVersion] rangeOfString:@"."
+ options:NSCaseInsensitiveSearch]
+ .location,
+ (unsigned)NSNotFound);
+}
+
+TEST(SystemInfoTest, GetOSVersionReturnsNumbers) {
+ NSArray* substrings =
+ [[SystemInfo getOSVersion] componentsSeparatedByString:@"."];
+ for (NSString* s in substrings) {
+ EXPECT_TRUE(([s intValue] != 0) || [s isEqualToString:@"0"]);
+ }
+}
+
+} // namespace

Powered by Google App Engine
This is Rietveld 408576698