OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "config.h" |
| 6 #import "platform/mac/VersionUtilMac.h" |
| 7 |
| 8 #include <AppKit/AppKit.h> |
| 9 #include <gtest/gtest.h> |
| 10 |
| 11 #ifndef NSAppKitVersionNumber10_7 |
| 12 #define NSAppKitVersionNumber10_7 1138 |
| 13 #endif |
| 14 |
| 15 #ifndef NSAppKitVersionNumber10_9 |
| 16 #define NSAppKitVersionNumber10_9 1265 |
| 17 #endif |
| 18 |
| 19 #ifndef NSAppKitVersionNumber10_10 |
| 20 #define NSAppKitVersionNumber10_10 1343 |
| 21 #endif |
| 22 |
| 23 // This number was determined by writing a tiny Cocoa App on 10.10.4. |
| 24 #define NSAppKitVersionNumber10_10Max 1348 |
| 25 |
| 26 // AppKit version is loosely correlated to OSX version. It's still useful as a |
| 27 // sanity check in unit tests, though we don't want to rely on it in production |
| 28 // code. |
| 29 TEST(VersionUtilMac, AppKitVersions) |
| 30 { |
| 31 if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_7) { |
| 32 EXPECT_TRUE(blink::IsOSLionOrEarlier()); |
| 33 EXPECT_TRUE(blink::IsOSMavericksOrEarlier()); |
| 34 EXPECT_FALSE(blink::IsOSMavericks()); |
| 35 return; |
| 36 } |
| 37 |
| 38 if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_9) { |
| 39 EXPECT_FALSE(blink::IsOSLionOrEarlier()); |
| 40 EXPECT_TRUE(blink::IsOSMavericksOrEarlier()); |
| 41 EXPECT_FALSE(blink::IsOSMavericks()); |
| 42 return; |
| 43 } |
| 44 if (floor(NSAppKitVersionNumber) == NSAppKitVersionNumber10_9) { |
| 45 EXPECT_FALSE(blink::IsOSLionOrEarlier()); |
| 46 EXPECT_TRUE(blink::IsOSMavericksOrEarlier()); |
| 47 EXPECT_TRUE(blink::IsOSMavericks()); |
| 48 return; |
| 49 } |
| 50 if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_10Max && |
| 51 floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_10) { |
| 52 EXPECT_FALSE(blink::IsOSLionOrEarlier()); |
| 53 EXPECT_FALSE(blink::IsOSMavericksOrEarlier()); |
| 54 EXPECT_FALSE(blink::IsOSMavericks()); |
| 55 return; |
| 56 } |
| 57 } |
OLD | NEW |