OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } else if (sizeof(intptr_t) == 4) { | 45 } else if (sizeof(intptr_t) == 4) { |
46 #if defined(CPU_ARM) | 46 #if defined(CPU_ARM) |
47 EXPECT_EQ(rtc::SystemInfo::SI_ARCH_ARM, architecture); | 47 EXPECT_EQ(rtc::SystemInfo::SI_ARCH_ARM, architecture); |
48 #else | 48 #else |
49 EXPECT_EQ(rtc::SystemInfo::SI_ARCH_X86, architecture); | 49 EXPECT_EQ(rtc::SystemInfo::SI_ARCH_X86, architecture); |
50 #endif | 50 #endif |
51 } | 51 } |
52 #endif | 52 #endif |
53 } | 53 } |
54 | 54 |
55 // Tests Cpu Cache Size | |
56 TEST(SystemInfoTest, CpuCacheSize) { | |
57 rtc::SystemInfo info; | |
58 LOG(LS_INFO) << "CpuCacheSize: " << info.GetCpuCacheSize(); | |
59 EXPECT_GE(info.GetCpuCacheSize(), 8192); // 8 KB min cache | |
60 EXPECT_LE(info.GetCpuCacheSize(), 1024 * 1024 * 1024); // 1 GB max cache | |
61 } | |
62 | |
63 // Tests MachineModel is set. On Mac test machine model is known. | 55 // Tests MachineModel is set. On Mac test machine model is known. |
64 TEST(SystemInfoTest, MachineModelKnown) { | 56 TEST(SystemInfoTest, MachineModelKnown) { |
65 rtc::SystemInfo info; | 57 rtc::SystemInfo info; |
66 EXPECT_FALSE(info.GetMachineModel().empty()); | 58 EXPECT_FALSE(info.GetMachineModel().empty()); |
67 const char *machine_model = info.GetMachineModel().c_str(); | 59 const char *machine_model = info.GetMachineModel().c_str(); |
68 LOG(LS_INFO) << "MachineModel: " << machine_model; | 60 LOG(LS_INFO) << "MachineModel: " << machine_model; |
69 bool known = true; | 61 bool known = true; |
70 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) | 62 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) |
71 // Full list as of May 2012. Update when new OSX based models are added. | 63 // Full list as of May 2012. Update when new OSX based models are added. |
72 known = rtc::string_match(machine_model, "MacBookPro*") || | 64 known = rtc::string_match(machine_model, "MacBookPro*") || |
73 rtc::string_match(machine_model, "MacBookAir*") || | 65 rtc::string_match(machine_model, "MacBookAir*") || |
74 rtc::string_match(machine_model, "MacBook*") || | 66 rtc::string_match(machine_model, "MacBook*") || |
75 rtc::string_match(machine_model, "MacPro*") || | 67 rtc::string_match(machine_model, "MacPro*") || |
76 rtc::string_match(machine_model, "Macmini*") || | 68 rtc::string_match(machine_model, "Macmini*") || |
77 rtc::string_match(machine_model, "iMac*") || | 69 rtc::string_match(machine_model, "iMac*") || |
78 rtc::string_match(machine_model, "Xserve*"); | 70 rtc::string_match(machine_model, "Xserve*"); |
79 #elif !defined(WEBRTC_IOS) | 71 #elif !defined(WEBRTC_IOS) |
80 // All other machines return Not available. | 72 // All other machines return Not available. |
81 known = rtc::string_match(info.GetMachineModel().c_str(), | 73 known = rtc::string_match(info.GetMachineModel().c_str(), |
82 "Not available"); | 74 "Not available"); |
83 #endif | 75 #endif |
84 if (!known) { | 76 if (!known) { |
85 LOG(LS_WARNING) << "Machine Model Unknown: " << machine_model; | 77 LOG(LS_WARNING) << "Machine Model Unknown: " << machine_model; |
86 } | 78 } |
87 } | 79 } |
88 | 80 |
89 // Tests maximum cpu clockrate. | |
90 TEST(SystemInfoTest, CpuMaxCpuSpeed) { | |
91 rtc::SystemInfo info; | |
92 LOG(LS_INFO) << "MaxCpuSpeed: " << info.GetMaxCpuSpeed(); | |
93 EXPECT_GT(info.GetMaxCpuSpeed(), 0); | |
94 EXPECT_LT(info.GetMaxCpuSpeed(), 100000); // 100 Ghz | |
95 } | |
96 | |
97 // Tests current cpu clockrate. | |
98 TEST(SystemInfoTest, CpuCurCpuSpeed) { | |
99 rtc::SystemInfo info; | |
100 LOG(LS_INFO) << "MaxCurSpeed: " << info.GetCurCpuSpeed(); | |
101 EXPECT_GT(info.GetCurCpuSpeed(), 0); | |
102 EXPECT_LT(info.GetMaxCpuSpeed(), 100000); | |
103 } | |
104 | |
105 // Tests physical memory size. | 81 // Tests physical memory size. |
106 TEST(SystemInfoTest, MemorySize) { | 82 TEST(SystemInfoTest, MemorySize) { |
107 rtc::SystemInfo info; | 83 rtc::SystemInfo info; |
108 LOG(LS_INFO) << "MemorySize: " << info.GetMemorySize(); | 84 LOG(LS_INFO) << "MemorySize: " << info.GetMemorySize(); |
109 EXPECT_GT(info.GetMemorySize(), -1); | 85 EXPECT_GT(info.GetMemorySize(), -1); |
110 } | 86 } |
111 | 87 |
112 // Tests number of logical cpus available to the system. | 88 // Tests number of logical cpus available to the system. |
113 TEST(SystemInfoTest, MaxCpus) { | 89 TEST(SystemInfoTest, MaxCpus) { |
114 rtc::SystemInfo info; | 90 rtc::SystemInfo info; |
115 LOG(LS_INFO) << "MaxCpus: " << info.GetMaxCpus(); | 91 LOG(LS_INFO) << "MaxCpus: " << info.GetMaxCpus(); |
116 EXPECT_GT(info.GetMaxCpus(), 0); | 92 EXPECT_GT(info.GetMaxCpus(), 0); |
117 } | 93 } |
118 | 94 |
119 // Tests number of physical cpus available to the system. | |
120 TEST(SystemInfoTest, MaxPhysicalCpus) { | |
121 rtc::SystemInfo info; | |
122 LOG(LS_INFO) << "MaxPhysicalCpus: " << info.GetMaxPhysicalCpus(); | |
123 EXPECT_GT(info.GetMaxPhysicalCpus(), 0); | |
124 EXPECT_LE(info.GetMaxPhysicalCpus(), info.GetMaxCpus()); | |
125 } | |
126 | |
127 // Tests number of logical cpus available to the process. | 95 // Tests number of logical cpus available to the process. |
128 TEST(SystemInfoTest, CurCpus) { | 96 TEST(SystemInfoTest, CurCpus) { |
129 rtc::SystemInfo info; | 97 rtc::SystemInfo info; |
130 LOG(LS_INFO) << "CurCpus: " << info.GetCurCpus(); | 98 LOG(LS_INFO) << "CurCpus: " << info.GetCurCpus(); |
131 EXPECT_GT(info.GetCurCpus(), 0); | 99 EXPECT_GT(info.GetCurCpus(), 0); |
132 EXPECT_LE(info.GetCurCpus(), info.GetMaxCpus()); | 100 EXPECT_LE(info.GetCurCpus(), info.GetMaxCpus()); |
133 } | 101 } |
134 | 102 |
135 #ifdef CPU_X86 | 103 #ifdef CPU_X86 |
136 // CPU family/model/stepping is only available on X86. The following tests | 104 // CPU family/model/stepping is only available on X86. The following tests |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 EXPECT_EQ(0, info.GetCpuModel()); | 141 EXPECT_EQ(0, info.GetCpuModel()); |
174 } | 142 } |
175 | 143 |
176 // Tests Intel CPU Stepping identification. | 144 // Tests Intel CPU Stepping identification. |
177 TEST(SystemInfoTest, CpuStepping) { | 145 TEST(SystemInfoTest, CpuStepping) { |
178 rtc::SystemInfo info; | 146 rtc::SystemInfo info; |
179 LOG(LS_INFO) << "CpuStepping: " << info.GetCpuStepping(); | 147 LOG(LS_INFO) << "CpuStepping: " << info.GetCpuStepping(); |
180 EXPECT_EQ(0, info.GetCpuStepping()); | 148 EXPECT_EQ(0, info.GetCpuStepping()); |
181 } | 149 } |
182 #endif // CPU_X86 | 150 #endif // CPU_X86 |
183 | |
184 #if WEBRTC_WIN && !defined(EXCLUDE_D3D9) | |
185 TEST(SystemInfoTest, GpuInfo) { | |
186 rtc::SystemInfo info; | |
187 rtc::SystemInfo::GpuInfo gi; | |
188 EXPECT_TRUE(info.GetGpuInfo(&gi)); | |
189 LOG(LS_INFO) << "GpuDriver: " << gi.driver; | |
190 EXPECT_FALSE(gi.driver.empty()); | |
191 LOG(LS_INFO) << "GpuDriverVersion: " << gi.driver_version; | |
192 EXPECT_FALSE(gi.driver_version.empty()); | |
193 } | |
194 #endif | |
OLD | NEW |