Chromium Code Reviews| 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..d9c01864074ee801f36269a2c54b479a0cd3b1f0 |
| --- /dev/null |
| +++ b/chrome/installer/mac/app/testing/SystemInfo_test.mm |
| @@ -0,0 +1,32 @@ |
| +// 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. |
| + |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +#import "chrome/installer/mac/app/SystemInfo.h" |
|
Mark Mentovai
2016/07/22 18:03:24
Likewise.
|
| + |
| +namespace { |
| + |
| +TEST(SystemInfoTest, GetArchReturnsExpectedString) { |
| + NSString* arch = [SystemInfo getArch]; |
| + |
| + EXPECT_TRUE([arch isEqualToString:@"i486"] || |
| + [arch isEqualToString:@"x86_64h"]); |
| +} |
| + |
| +TEST(SystemInfoTest, GetOSVersionMatchesRegexFormat) { |
| + NSString* os_version = [SystemInfo getOSVersion]; |
| + |
| + NSRegularExpression* regex = [NSRegularExpression |
| + regularExpressionWithPattern:@"^10\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$" |
| + options:0 |
| + error:nil]; |
| + NSUInteger matches = |
| + [regex numberOfMatchesInString:os_version |
| + options:0 |
| + range:NSMakeRange(0, os_version.length)]; |
| + EXPECT_EQ(1u, matches); |
| +} |
| + |
| +} // namespace |