MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / Platform

Class Platform

dotnet/src/webdriver/Platform.cs:83–199  ·  view source on GitHub ↗

Represents the platform on which tests are to be run.

Source from the content-addressed store, hash-verified

81/// Represents the platform on which tests are to be run.
82/// </summary>
83public class Platform
84{
85 private static Platform? current;
86
87 /// <summary>
88 /// Initializes a new instance of the <see cref="Platform"/> class for a specific platform type.
89 /// </summary>
90 /// <param name="typeValue">The platform type.</param>
91 public Platform(PlatformType typeValue)
92 {
93 this.PlatformType = typeValue;
94 }
95
96 private Platform()
97 {
98 this.MajorVersion = Environment.OSVersion.Version.Major;
99 this.MinorVersion = Environment.OSVersion.Version.Minor;
100
101 switch (Environment.OSVersion.Platform)
102 {
103 case PlatformID.Win32NT:
104 if (this.MajorVersion == 5)
105 {
106 this.PlatformType = PlatformType.XP;
107 }
108 else if (this.MajorVersion == 6)
109 {
110 this.PlatformType = PlatformType.Vista;
111 }
112 else
113 {
114 this.PlatformType = PlatformType.Windows;
115 }
116
117 break;
118
119 // Thanks to a bug in Mono Mac and Linux will be treated the same https://bugzilla.novell.com/show_bug.cgi?id=515570 but adding this in case
120 case PlatformID.MacOSX:
121 this.PlatformType = PlatformType.Mac;
122 break;
123
124 case PlatformID.Unix:
125 this.PlatformType = PlatformType.Unix;
126 break;
127 }
128 }
129
130 /// <summary>
131 /// Gets the current platform.
132 /// </summary>
133 public static Platform CurrentPlatform => current ??= new Platform();
134
135 /// <summary>
136 /// Gets the major version of the platform operating system.
137 /// </summary>
138 public int MajorVersion { get; }
139
140 /// <summary>

Callers

nothing calls this directly

Calls 1

ToStringMethod · 0.45

Tested by

no test coverage detected