OLD | NEW |
| (Empty) |
1 // Copyright 2003-2009 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 | |
16 #include <atlstr.h> | |
17 #include "omaha/base/system_info.h" | |
18 #include "omaha/testing/unit_test.h" | |
19 | |
20 namespace omaha { | |
21 | |
22 TEST(SystemInfoTest, SystemInfo) { | |
23 SystemInfo::OSVersionType os_type = SystemInfo::OS_WINDOWS_UNKNOWN; | |
24 DWORD service_pack = 0; | |
25 ASSERT_SUCCEEDED(SystemInfo::CategorizeOS(&os_type, &service_pack)); | |
26 } | |
27 | |
28 TEST(SystemInfoTest, GetSystemVersion) { | |
29 int major_version(0); | |
30 int minor_version(0); | |
31 int service_pack_major(0); | |
32 int service_pack_minor(0); | |
33 | |
34 CString name; | |
35 ASSERT_TRUE(SystemInfo::GetSystemVersion(&major_version, | |
36 &minor_version, | |
37 &service_pack_major, | |
38 &service_pack_minor, | |
39 CStrBuf(name, MAX_PATH), | |
40 MAX_PATH)); | |
41 EXPECT_NE(0, major_version); | |
42 EXPECT_EQ(0, service_pack_minor); | |
43 | |
44 EXPECT_FALSE(name.IsEmpty()); | |
45 } | |
46 | |
47 TEST(SystemInfoTest, Is64BitWindows) { | |
48 DWORD arch(SystemInfo::GetProcessorArchitecture()); | |
49 | |
50 if (arch == PROCESSOR_ARCHITECTURE_INTEL) { | |
51 EXPECT_FALSE(SystemInfo::Is64BitWindows()); | |
52 } else { | |
53 EXPECT_TRUE(SystemInfo::Is64BitWindows()); | |
54 } | |
55 } | |
56 | |
57 TEST(SystemInfoTest, GetProcessorArchitecture) { | |
58 DWORD arch(SystemInfo::GetProcessorArchitecture()); | |
59 | |
60 // TODO(omaha3): Maybe we could look for the presence of a wow6432 key in the | |
61 // registry to detect. | |
62 EXPECT_TRUE(arch == PROCESSOR_ARCHITECTURE_INTEL || | |
63 arch == PROCESSOR_ARCHITECTURE_AMD64); | |
64 } | |
65 | |
66 } // namespace omaha | |
67 | |
OLD | NEW |