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

Side by Side Diff: ui/views/cocoa/bridged_native_widget_interactive_uitest.mm

Issue 1849343003: mac: Remove IsOSSnowLeopard(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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
OLDNEW
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/cocoa/bridged_native_widget.h" 5 #import "ui/views/cocoa/bridged_native_widget.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #import "base/mac/mac_util.h" 9 #import "base/mac/mac_util.h"
10 #import "base/mac/sdk_forward_declarations.h" 10 #import "base/mac/sdk_forward_declarations.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 protected: 72 protected:
73 scoped_ptr<Widget> widget_; 73 scoped_ptr<Widget> widget_;
74 }; 74 };
75 75
76 // Tests for correct fullscreen tracking, regardless of whether it is initiated 76 // Tests for correct fullscreen tracking, regardless of whether it is initiated
77 // by the Widget code or elsewhere (e.g. by the user). 77 // by the Widget code or elsewhere (e.g. by the user).
78 TEST_F(BridgedNativeWidgetUITest, FullscreenSynchronousState) { 78 TEST_F(BridgedNativeWidgetUITest, FullscreenSynchronousState) {
79 EXPECT_FALSE(widget_->IsFullscreen()); 79 EXPECT_FALSE(widget_->IsFullscreen());
80 if (base::mac::IsOSSnowLeopard())
81 return;
82 80
83 // Allow user-initiated fullscreen changes on the Window. 81 // Allow user-initiated fullscreen changes on the Window.
84 [test_window() 82 [test_window()
85 setCollectionBehavior:[test_window() collectionBehavior] | 83 setCollectionBehavior:[test_window() collectionBehavior] |
86 NSWindowCollectionBehaviorFullScreenPrimary]; 84 NSWindowCollectionBehaviorFullScreenPrimary];
87 85
88 base::scoped_nsobject<NSWindowFullscreenNotificationWaiter> waiter( 86 base::scoped_nsobject<NSWindowFullscreenNotificationWaiter> waiter(
89 [[NSWindowFullscreenNotificationWaiter alloc] 87 [[NSWindowFullscreenNotificationWaiter alloc]
90 initWithWindow:test_window()]); 88 initWithWindow:test_window()]);
91 const gfx::Rect restored_bounds = widget_->GetRestoredBounds(); 89 const gfx::Rect restored_bounds = widget_->GetRestoredBounds();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 137
140 EXPECT_FALSE(widget_->IsFullscreen()); 138 EXPECT_FALSE(widget_->IsFullscreen());
141 const gfx::Rect restored_bounds = widget_->GetRestoredBounds(); 139 const gfx::Rect restored_bounds = widget_->GetRestoredBounds();
142 EXPECT_FALSE(restored_bounds.IsEmpty()); 140 EXPECT_FALSE(restored_bounds.IsEmpty());
143 141
144 // Ensure this works without having to change collection behavior as for the 142 // Ensure this works without having to change collection behavior as for the
145 // test above. Also check that making a hidden widget fullscreen shows it. 143 // test above. Also check that making a hidden widget fullscreen shows it.
146 EXPECT_FALSE(widget_->IsVisible()); 144 EXPECT_FALSE(widget_->IsVisible());
147 widget_->SetFullscreen(true); 145 widget_->SetFullscreen(true);
148 EXPECT_TRUE(widget_->IsVisible()); 146 EXPECT_TRUE(widget_->IsVisible());
149 if (base::mac::IsOSSnowLeopard()) {
150 // On Snow Leopard, SetFullscreen() isn't implemented. But shouldn't crash.
151 EXPECT_FALSE(widget_->IsFullscreen());
152 return;
153 }
154 147
155 EXPECT_TRUE(widget_->IsFullscreen()); 148 EXPECT_TRUE(widget_->IsFullscreen());
156 EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); 149 EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds());
157 150
158 // Should be zero until the runloop spins. 151 // Should be zero until the runloop spins.
159 EXPECT_EQ(0, [waiter enterCount]); 152 EXPECT_EQ(0, [waiter enterCount]);
160 [waiter waitForEnterCount:1 exitCount:0]; 153 [waiter waitForEnterCount:1 exitCount:0];
161 154
162 // Verify it hasn't exceeded. 155 // Verify it hasn't exceeded.
163 EXPECT_EQ(1, [waiter enterCount]); 156 EXPECT_EQ(1, [waiter enterCount]);
164 EXPECT_EQ(0, [waiter exitCount]); 157 EXPECT_EQ(0, [waiter exitCount]);
165 EXPECT_TRUE(widget_->IsFullscreen()); 158 EXPECT_TRUE(widget_->IsFullscreen());
166 EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); 159 EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds());
167 160
168 widget_->SetFullscreen(false); 161 widget_->SetFullscreen(false);
169 EXPECT_FALSE(widget_->IsFullscreen()); 162 EXPECT_FALSE(widget_->IsFullscreen());
170 EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); 163 EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds());
171 164
172 [waiter waitForEnterCount:1 exitCount:1]; 165 [waiter waitForEnterCount:1 exitCount:1];
173 EXPECT_EQ(1, [waiter enterCount]); 166 EXPECT_EQ(1, [waiter enterCount]);
174 EXPECT_EQ(1, [waiter exitCount]); 167 EXPECT_EQ(1, [waiter exitCount]);
175 EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds()); 168 EXPECT_EQ(restored_bounds, widget_->GetRestoredBounds());
176 } 169 }
177 170
178 // Test that Widget::Restore exits fullscreen. 171 // Test that Widget::Restore exits fullscreen.
179 TEST_F(BridgedNativeWidgetUITest, FullscreenRestore) { 172 TEST_F(BridgedNativeWidgetUITest, FullscreenRestore) {
180 if (base::mac::IsOSSnowLeopard())
181 return;
182
183 base::scoped_nsobject<NSWindowFullscreenNotificationWaiter> waiter( 173 base::scoped_nsobject<NSWindowFullscreenNotificationWaiter> waiter(
184 [[NSWindowFullscreenNotificationWaiter alloc] 174 [[NSWindowFullscreenNotificationWaiter alloc]
185 initWithWindow:test_window()]); 175 initWithWindow:test_window()]);
186 176
187 EXPECT_FALSE(widget_->IsFullscreen()); 177 EXPECT_FALSE(widget_->IsFullscreen());
188 const gfx::Rect restored_bounds = widget_->GetRestoredBounds(); 178 const gfx::Rect restored_bounds = widget_->GetRestoredBounds();
189 EXPECT_FALSE(restored_bounds.IsEmpty()); 179 EXPECT_FALSE(restored_bounds.IsEmpty());
190 180
191 widget_->SetFullscreen(true); 181 widget_->SetFullscreen(true);
192 EXPECT_TRUE(widget_->IsFullscreen()); 182 EXPECT_TRUE(widget_->IsFullscreen());
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 NSEvent* mouse_up = cocoa_test_event_utils::MouseEventAtPointInWindow( 476 NSEvent* mouse_up = cocoa_test_event_utils::MouseEventAtPointInWindow(
487 NSMakePoint(30, 30), NSLeftMouseUp, window, 0); 477 NSMakePoint(30, 30), NSLeftMouseUp, window, 0);
488 CGEventPost(kCGSessionEventTap, [mouse_up CGEvent]); 478 CGEventPost(kCGSessionEventTap, [mouse_up CGEvent]);
489 WaitForEvent(NSLeftMouseUpMask); 479 WaitForEvent(NSLeftMouseUpMask);
490 EXPECT_EQ(120, [window frame].origin.x); 480 EXPECT_EQ(120, [window frame].origin.x);
491 } 481 }
492 } 482 }
493 483
494 } // namespace test 484 } // namespace test
495 } // namespace views 485 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/cocoa/bridged_native_widget_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698