Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: Source/platform/mac/VersionUtilMacTest.mm

Issue 1288823004: Reland #1: Fix the mechanism by which Blink determines OSX version number. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix logic error in unit test. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/mac/VersionUtilMac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « Source/platform/mac/VersionUtilMac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698