| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "platform/mac/VersionUtilMac.h" | 5 #import "platform/mac/VersionUtilMac.h" |
| 6 | 6 |
| 7 #include <AppKit/AppKit.h> | 7 #include <AppKit/AppKit.h> |
| 8 #include <gtest/gtest.h> | 8 #include <gtest/gtest.h> |
| 9 | 9 |
| 10 #ifndef NSAppKitVersionNumber10_9 | 10 #ifndef NSAppKitVersionNumber10_9 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // AppKit.framework does not provide an NSAppKitVersionNumber preprocessor | 22 // AppKit.framework does not provide an NSAppKitVersionNumber preprocessor |
| 23 // definition for OSX 10.11. | 23 // definition for OSX 10.11. |
| 24 #define NSAppKitVersionNumber10_11Max 1389 | 24 #define NSAppKitVersionNumber10_11Max 1389 |
| 25 | 25 |
| 26 // AppKit version is loosely correlated to OSX version. It's still useful as a | 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 | 27 // sanity check in unit tests, though we don't want to rely on it in production |
| 28 // code. | 28 // code. |
| 29 TEST(VersionUtilMac, AppKitVersions) | 29 TEST(VersionUtilMac, AppKitVersions) |
| 30 { | 30 { |
| 31 if (floor(NSAppKitVersionNumber) == NSAppKitVersionNumber10_9) { | 31 if (floor(NSAppKitVersionNumber) == NSAppKitVersionNumber10_9) { |
| 32 EXPECT_TRUE(blink::IsOSMavericks()); | 32 EXPECT_TRUE(blink::IsOS10_9()); |
| 33 EXPECT_FALSE(blink::IsOSYosemite()); | 33 EXPECT_FALSE(blink::IsOS10_10()); |
| 34 EXPECT_FALSE(blink::IsOSElCapitan()); | 34 EXPECT_FALSE(blink::IsOS10_11()); |
| 35 return; | 35 return; |
| 36 } | 36 } |
| 37 | 37 |
| 38 if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_10Max && | 38 if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_10Max && |
| 39 floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_10) { | 39 floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_10) { |
| 40 EXPECT_FALSE(blink::IsOSMavericks()); | 40 EXPECT_FALSE(blink::IsOS10_9()); |
| 41 EXPECT_TRUE(blink::IsOSYosemite()); | 41 EXPECT_TRUE(blink::IsOS10_10()); |
| 42 EXPECT_FALSE(blink::IsOSElCapitan()); | 42 EXPECT_FALSE(blink::IsOS10_11()); |
| 43 return; | 43 return; |
| 44 } | 44 } |
| 45 | 45 |
| 46 if (floor(NSAppKitVersionNumber) == NSAppKitVersionNumber10_11Max) { | 46 if (floor(NSAppKitVersionNumber) == NSAppKitVersionNumber10_11Max) { |
| 47 EXPECT_FALSE(blink::IsOSMavericks()); | 47 EXPECT_FALSE(blink::IsOS10_9()); |
| 48 EXPECT_FALSE(blink::IsOSYosemite()); | 48 EXPECT_FALSE(blink::IsOS10_10()); |
| 49 EXPECT_TRUE(blink::IsOSElCapitan()); | 49 EXPECT_TRUE(blink::IsOS10_11()); |
| 50 return; | 50 return; |
| 51 } | 51 } |
| 52 } | 52 } |
| OLD | NEW |