OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 #include <stddef.h> | 6 #include <stddef.h> |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 NSObjectRelease(array); | 139 NSObjectRelease(array); |
140 EXPECT_EQ(1U, [array retainCount]); | 140 EXPECT_EQ(1U, [array retainCount]); |
141 } | 141 } |
142 | 142 |
143 TEST_F(MacUtilTest, IsOSEllipsis) { | 143 TEST_F(MacUtilTest, IsOSEllipsis) { |
144 int32_t major, minor, bugfix; | 144 int32_t major, minor, bugfix; |
145 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); | 145 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); |
146 | 146 |
147 if (major == 10) { | 147 if (major == 10) { |
148 if (minor == 9) { | 148 if (minor == 9) { |
149 EXPECT_TRUE(IsOSMavericks()); | 149 EXPECT_TRUE(IsOS10_9()); |
150 EXPECT_FALSE(IsOSYosemite()); | 150 EXPECT_TRUE(IsAtMostOS10_9()); |
151 EXPECT_TRUE(IsOSYosemiteOrEarlier()); | 151 EXPECT_TRUE(IsAtLeastOS10_9()); |
152 EXPECT_FALSE(IsOSYosemiteOrLater()); | 152 EXPECT_FALSE(IsOS10_10()); |
153 EXPECT_FALSE(IsOSElCapitan()); | 153 EXPECT_TRUE(IsAtMostOS10_10()); |
154 EXPECT_TRUE(IsOSElCapitanOrEarlier()); | 154 EXPECT_FALSE(IsAtLeastOS10_10()); |
155 EXPECT_FALSE(IsOSElCapitanOrLater()); | 155 EXPECT_FALSE(IsOS10_11()); |
156 EXPECT_FALSE(IsOSSierra()); | 156 EXPECT_TRUE(IsAtMostOS10_11()); |
157 EXPECT_FALSE(IsOSSierraOrLater()); | 157 EXPECT_FALSE(IsAtLeastOS10_11()); |
158 EXPECT_FALSE(IsOSLaterThanSierra_DontCallThis()); | 158 EXPECT_FALSE(IsOS10_12()); |
| 159 EXPECT_FALSE(IsAtLeastOS10_12()); |
| 160 EXPECT_TRUE(IsAtMostOS10_12()); |
| 161 EXPECT_FALSE(IsOSLaterThan10_12_DontCallThis()); |
159 } else if (minor == 10) { | 162 } else if (minor == 10) { |
160 EXPECT_FALSE(IsOSMavericks()); | 163 EXPECT_FALSE(IsOS10_9()); |
161 EXPECT_TRUE(IsOSYosemite()); | 164 EXPECT_FALSE(IsAtMostOS10_9()); |
162 EXPECT_TRUE(IsOSYosemiteOrEarlier()); | 165 EXPECT_TRUE(IsAtLeastOS10_9()); |
163 EXPECT_TRUE(IsOSYosemiteOrLater()); | 166 EXPECT_TRUE(IsOS10_10()); |
164 EXPECT_FALSE(IsOSElCapitan()); | 167 EXPECT_TRUE(IsAtMostOS10_10()); |
165 EXPECT_TRUE(IsOSElCapitanOrEarlier()); | 168 EXPECT_TRUE(IsAtLeastOS10_10()); |
166 EXPECT_FALSE(IsOSElCapitanOrLater()); | 169 EXPECT_FALSE(IsOS10_11()); |
167 EXPECT_FALSE(IsOSSierra()); | 170 EXPECT_TRUE(IsAtMostOS10_11()); |
168 EXPECT_FALSE(IsOSSierraOrLater()); | 171 EXPECT_FALSE(IsAtLeastOS10_11()); |
169 EXPECT_FALSE(IsOSLaterThanSierra_DontCallThis()); | 172 EXPECT_FALSE(IsOS10_12()); |
| 173 EXPECT_FALSE(IsAtLeastOS10_12()); |
| 174 EXPECT_TRUE(IsAtMostOS10_12()); |
| 175 EXPECT_FALSE(IsOSLaterThan10_12_DontCallThis()); |
170 } else if (minor == 11) { | 176 } else if (minor == 11) { |
171 EXPECT_FALSE(IsOSMavericks()); | 177 EXPECT_FALSE(IsOS10_9()); |
172 EXPECT_FALSE(IsOSYosemite()); | 178 EXPECT_FALSE(IsAtMostOS10_9()); |
173 EXPECT_FALSE(IsOSYosemiteOrEarlier()); | 179 EXPECT_TRUE(IsAtLeastOS10_9()); |
174 EXPECT_TRUE(IsOSYosemiteOrLater()); | 180 EXPECT_FALSE(IsOS10_10()); |
175 EXPECT_TRUE(IsOSElCapitan()); | 181 EXPECT_FALSE(IsAtMostOS10_10()); |
176 EXPECT_TRUE(IsOSElCapitanOrEarlier()); | 182 EXPECT_TRUE(IsAtLeastOS10_10()); |
177 EXPECT_TRUE(IsOSElCapitanOrLater()); | 183 EXPECT_TRUE(IsOS10_11()); |
178 EXPECT_FALSE(IsOSSierra()); | 184 EXPECT_TRUE(IsAtMostOS10_11()); |
179 EXPECT_FALSE(IsOSSierraOrLater()); | 185 EXPECT_TRUE(IsAtLeastOS10_11()); |
180 EXPECT_FALSE(IsOSLaterThanSierra_DontCallThis()); | 186 EXPECT_FALSE(IsOS10_12()); |
| 187 EXPECT_FALSE(IsAtLeastOS10_12()); |
| 188 EXPECT_TRUE(IsAtMostOS10_12()); |
| 189 EXPECT_FALSE(IsOSLaterThan10_12_DontCallThis()); |
181 } else if (minor == 12) { | 190 } else if (minor == 12) { |
182 EXPECT_FALSE(IsOSMavericks()); | 191 EXPECT_FALSE(IsOS10_9()); |
183 EXPECT_FALSE(IsOSYosemite()); | 192 EXPECT_FALSE(IsAtMostOS10_9()); |
184 EXPECT_FALSE(IsOSYosemiteOrEarlier()); | 193 EXPECT_TRUE(IsAtLeastOS10_9()); |
185 EXPECT_TRUE(IsOSYosemiteOrLater()); | 194 EXPECT_FALSE(IsOS10_10()); |
186 EXPECT_FALSE(IsOSElCapitan()); | 195 EXPECT_FALSE(IsAtMostOS10_10()); |
187 EXPECT_FALSE(IsOSElCapitanOrEarlier()); | 196 EXPECT_TRUE(IsAtLeastOS10_10()); |
188 EXPECT_TRUE(IsOSElCapitanOrLater()); | 197 EXPECT_FALSE(IsOS10_11()); |
189 EXPECT_TRUE(IsOSSierra()); | 198 EXPECT_FALSE(IsAtMostOS10_11()); |
190 EXPECT_TRUE(IsOSSierraOrLater()); | 199 EXPECT_TRUE(IsAtLeastOS10_11()); |
191 EXPECT_FALSE(IsOSLaterThanSierra_DontCallThis()); | 200 EXPECT_TRUE(IsOS10_12()); |
| 201 EXPECT_TRUE(IsAtMostOS10_12()); |
| 202 EXPECT_TRUE(IsAtLeastOS10_12()); |
| 203 EXPECT_FALSE(IsOSLaterThan10_12_DontCallThis()); |
192 } else { | 204 } else { |
193 // Not nine, ten, eleven, or twelve. Ah, ah, ah. | 205 // Not nine, ten, eleven, or twelve. Ah, ah, ah. |
194 EXPECT_TRUE(false); | 206 EXPECT_TRUE(false); |
195 } | 207 } |
196 } else { | 208 } else { |
197 // Not ten. What you gonna do? | 209 // Not ten. What you gonna do? |
198 EXPECT_FALSE(true); | 210 EXPECT_FALSE(true); |
199 } | 211 } |
200 } | 212 } |
201 | 213 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 269 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
258 FilePath non_existent_path = temp_dir_.path().Append("DummyPath"); | 270 FilePath non_existent_path = temp_dir_.path().Append("DummyPath"); |
259 ASSERT_FALSE(PathExists(non_existent_path)); | 271 ASSERT_FALSE(PathExists(non_existent_path)); |
260 EXPECT_FALSE(RemoveQuarantineAttribute(non_existent_path)); | 272 EXPECT_FALSE(RemoveQuarantineAttribute(non_existent_path)); |
261 } | 273 } |
262 | 274 |
263 } // namespace | 275 } // namespace |
264 | 276 |
265 } // namespace mac | 277 } // namespace mac |
266 } // namespace base | 278 } // namespace base |
OLD | NEW |