OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/views/widget/native_widget_mac.h" | 5 #import "ui/views/widget/native_widget_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 TEST_F(NativeWidgetMacTest, GetWorkAreaBoundsInScreen) { | 1074 TEST_F(NativeWidgetMacTest, GetWorkAreaBoundsInScreen) { |
1075 Widget widget; | 1075 Widget widget; |
1076 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); | 1076 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP); |
1077 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 1077 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
1078 | 1078 |
1079 // This is relative to the top-left of the primary screen, so unless the bot's | 1079 // This is relative to the top-left of the primary screen, so unless the bot's |
1080 // display is smaller than 400x300, the window will be wholly contained there. | 1080 // display is smaller than 400x300, the window will be wholly contained there. |
1081 params.bounds = gfx::Rect(100, 100, 300, 200); | 1081 params.bounds = gfx::Rect(100, 100, 300, 200); |
1082 widget.Init(params); | 1082 widget.Init(params); |
1083 widget.Show(); | 1083 widget.Show(); |
1084 NSRect expected = [[[NSScreen screens] objectAtIndex:0] visibleFrame]; | 1084 NSRect expected = [[[NSScreen screens] firstObject] visibleFrame]; |
1085 NSRect actual = gfx::ScreenRectToNSRect(widget.GetWorkAreaBoundsInScreen()); | 1085 NSRect actual = gfx::ScreenRectToNSRect(widget.GetWorkAreaBoundsInScreen()); |
1086 EXPECT_FALSE(NSIsEmptyRect(actual)); | 1086 EXPECT_FALSE(NSIsEmptyRect(actual)); |
1087 EXPECT_NSEQ(expected, actual); | 1087 EXPECT_NSEQ(expected, actual); |
1088 | 1088 |
1089 [widget.GetNativeWindow() close]; | 1089 [widget.GetNativeWindow() close]; |
1090 actual = gfx::ScreenRectToNSRect(widget.GetWorkAreaBoundsInScreen()); | 1090 actual = gfx::ScreenRectToNSRect(widget.GetWorkAreaBoundsInScreen()); |
1091 EXPECT_TRUE(NSIsEmptyRect(actual)); | 1091 EXPECT_TRUE(NSIsEmptyRect(actual)); |
1092 } | 1092 } |
1093 | 1093 |
1094 } // namespace test | 1094 } // namespace test |
1095 } // namespace views | 1095 } // namespace views |
1096 | 1096 |
1097 @implementation TestStopAnimationWaiter | 1097 @implementation TestStopAnimationWaiter |
1098 - (void)setWindowStateForEnd { | 1098 - (void)setWindowStateForEnd { |
1099 views::test::ScopedSwizzleWaiter::GetMethodAndMarkCalled()(self, _cmd); | 1099 views::test::ScopedSwizzleWaiter::GetMethodAndMarkCalled()(self, _cmd); |
1100 } | 1100 } |
1101 @end | 1101 @end |
1102 | 1102 |
1103 @implementation NativeWidgetMacTestWindow | 1103 @implementation NativeWidgetMacTestWindow |
1104 | 1104 |
1105 @synthesize invalidateShadowCount = invalidateShadowCount_; | 1105 @synthesize invalidateShadowCount = invalidateShadowCount_; |
1106 | 1106 |
1107 - (void)invalidateShadow { | 1107 - (void)invalidateShadow { |
1108 ++invalidateShadowCount_; | 1108 ++invalidateShadowCount_; |
1109 [super invalidateShadow]; | 1109 [super invalidateShadow]; |
1110 } | 1110 } |
1111 | 1111 |
1112 @end | 1112 @end |
OLD | NEW |