xref: /aosp_15_r20/external/webrtc/rtc_base/win/windows_version_unittest.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "rtc_base/win/windows_version.h"
12 
13 #include "rtc_base/gunit.h"
14 #include "rtc_base/logging.h"
15 
16 namespace rtc {
17 namespace rtc_win {
18 namespace {
19 
MethodSupportedOnWin10AndLater()20 void MethodSupportedOnWin10AndLater() {
21   RTC_DLOG(LS_INFO) << "MethodSupportedOnWin10AndLater";
22 }
23 
MethodNotSupportedOnWin10AndLater()24 void MethodNotSupportedOnWin10AndLater() {
25   RTC_DLOG(LS_INFO) << "MethodNotSupportedOnWin10AndLater";
26 }
27 
28 // Use global GetVersion() and use it in a way a user would typically use it
29 // when checking for support of a certain API:
30 // "if (rtc_win::GetVersion() < VERSION_WIN10) ...".
TEST(WindowsVersion,GetVersionGlobalScopeAccessor)31 TEST(WindowsVersion, GetVersionGlobalScopeAccessor) {
32   if (GetVersion() < VERSION_WIN10) {
33     MethodNotSupportedOnWin10AndLater();
34   } else {
35     MethodSupportedOnWin10AndLater();
36   }
37 }
38 
TEST(WindowsVersion,ProcessorModelName)39 TEST(WindowsVersion, ProcessorModelName) {
40   std::string name = OSInfo::GetInstance()->processor_model_name();
41   EXPECT_FALSE(name.empty());
42   RTC_DLOG(LS_INFO) << "processor_model_name: " << name;
43 }
44 
45 }  // namespace
46 }  // namespace rtc_win
47 }  // namespace rtc
48