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 <objc/runtime.h> | 6 #include <objc/runtime.h> |
7 | 7 |
8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #import "chrome/browser/ui/cocoa/custom_frame_view.h" | 10 #import "chrome/browser/ui/cocoa/custom_frame_view.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 view_.reset([[customFrameClass alloc] initWithFrame:frame]); | 21 view_.reset([[customFrameClass alloc] initWithFrame:frame]); |
22 } | 22 } |
23 | 23 |
24 base::scoped_nsobject<NSView> view_; | 24 base::scoped_nsobject<NSView> view_; |
25 }; | 25 }; |
26 | 26 |
27 // Test to make sure our class modifications were successful. | 27 // Test to make sure our class modifications were successful. |
28 TEST_F(CustomFrameViewTest, SuccessfulClassModifications) { | 28 TEST_F(CustomFrameViewTest, SuccessfulClassModifications) { |
29 // In Yosemite, the fullscreen button replaces the zoom button. We no longer | 29 // In Yosemite, the fullscreen button replaces the zoom button. We no longer |
30 // need to swizzle out this AppKit private method. | 30 // need to swizzle out this AppKit private method. |
31 if (!base::mac::IsOSMavericks()) | 31 if (!base::mac::IsOS10_9()) |
32 return; | 32 return; |
33 | 33 |
34 unsigned int count; | 34 unsigned int count; |
35 BOOL foundSwizzledMethod = NO; | 35 BOOL foundSwizzledMethod = NO; |
36 | 36 |
37 Method* methods = class_copyMethodList([view_ class], &count); | 37 Method* methods = class_copyMethodList([view_ class], &count); |
38 for (unsigned int i = 0; i < count; ++i) { | 38 for (unsigned int i = 0; i < count; ++i) { |
39 SEL selector = method_getName(methods[i]); | 39 SEL selector = method_getName(methods[i]); |
40 if (selector == @selector(_fullScreenButtonOriginOriginal)) | 40 if (selector == @selector(_fullScreenButtonOriginOriginal)) |
41 foundSwizzledMethod = YES; | 41 foundSwizzledMethod = YES; |
42 } | 42 } |
43 EXPECT_TRUE(foundSwizzledMethod); | 43 EXPECT_TRUE(foundSwizzledMethod); |
44 free(methods); | 44 free(methods); |
45 } | 45 } |
OLD | NEW |