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

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

Issue 659233002: STASH: Epic Experimental patch for toolkit-views App List on Mac Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Fix a few things. Works@master Created 6 years, 2 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 | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/cocoa/views_nswindow_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/foundation_util.h" 9 #import "base/mac/foundation_util.h"
10 #import "base/mac/sdk_forward_declarations.h" 10 #import "base/mac/sdk_forward_declarations.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 std::string GetText(); 220 std::string GetText();
221 221
222 // testing::Test: 222 // testing::Test:
223 virtual void SetUp() override; 223 virtual void SetUp() override;
224 virtual void TearDown() override; 224 virtual void TearDown() override;
225 225
226 protected: 226 protected:
227 scoped_ptr<views::View> view_; 227 scoped_ptr<views::View> view_;
228 scoped_ptr<BridgedNativeWidget> bridge_; 228 scoped_ptr<BridgedNativeWidget> bridge_;
229 BridgedContentView* ns_view_; // Weak. Owned by bridge_. 229 BridgedContentView* ns_view_; // Weak. Owned by bridge_.
230 base::MessageLoopForUI message_loop_;
230 231
231 private: 232 private:
232 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetTest); 233 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetTest);
233 }; 234 };
234 235
235 BridgedNativeWidgetTest::BridgedNativeWidgetTest() { 236 BridgedNativeWidgetTest::BridgedNativeWidgetTest() {
236 } 237 }
237 238
238 BridgedNativeWidgetTest::~BridgedNativeWidgetTest() { 239 BridgedNativeWidgetTest::~BridgedNativeWidgetTest() {
239 } 240 }
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 // BridgedNativeWidget will think it's just a delayed transition and try to go 652 // BridgedNativeWidget will think it's just a delayed transition and try to go
652 // back into fullscreen but get ignored by Cocoa. 653 // back into fullscreen but get ignored by Cocoa.
653 EXPECT_EQ(0, [window ignoredToggleFullScreenCount]); 654 EXPECT_EQ(0, [window ignoredToggleFullScreenCount]);
654 EXPECT_TRUE(bridge()->target_fullscreen_state()); 655 EXPECT_TRUE(bridge()->target_fullscreen_state());
655 [center postNotificationName:NSWindowDidExitFullScreenNotification 656 [center postNotificationName:NSWindowDidExitFullScreenNotification
656 object:window]; 657 object:window];
657 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); 658 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]);
658 EXPECT_FALSE(bridge()->target_fullscreen_state()); 659 EXPECT_FALSE(bridge()->target_fullscreen_state());
659 660
660 // Cocoa follows up with a failure notification. 661 // Cocoa follows up with a failure notification.
661 [center postNotificationName:NSWindowDidFailToEnterFullScreenNotification 662 [[window delegate] windowDidFailToEnterFullScreen:window];
662 object:window];
663 EXPECT_FALSE(bridge()->target_fullscreen_state()); 663 EXPECT_FALSE(bridge()->target_fullscreen_state());
664 664
665 // Now perform a successful fullscreen operation. 665 // Now perform a successful fullscreen operation.
666 [center postNotificationName:NSWindowWillEnterFullScreenNotification 666 [center postNotificationName:NSWindowWillEnterFullScreenNotification
667 object:window]; 667 object:window];
668 EXPECT_TRUE(bridge()->target_fullscreen_state()); 668 EXPECT_TRUE(bridge()->target_fullscreen_state());
669 [center postNotificationName:NSWindowDidEnterFullScreenNotification 669 [center postNotificationName:NSWindowDidEnterFullScreenNotification
670 object:window]; 670 object:window];
671 EXPECT_TRUE(bridge()->target_fullscreen_state()); 671 EXPECT_TRUE(bridge()->target_fullscreen_state());
672 672
673 // And try to get out. 673 // And try to get out.
674 [center postNotificationName:NSWindowWillExitFullScreenNotification 674 [center postNotificationName:NSWindowWillExitFullScreenNotification
675 object:window]; 675 object:window];
676 EXPECT_FALSE(bridge()->target_fullscreen_state()); 676 EXPECT_FALSE(bridge()->target_fullscreen_state());
677 677
678 // On a failure, Cocoa sends a failure notification, but then just dumps the 678 // On a failure, Cocoa sends a failure notification, but then just dumps the
679 // Window out of fullscreen anyway (in that order). 679 // Window out of fullscreen anyway (in that order).
680 [center postNotificationName:NSWindowDidFailToExitFullScreenNotification 680 [[window delegate] windowDidFailToExitFullScreen:window];
681 object:window];
682 EXPECT_FALSE(bridge()->target_fullscreen_state()); 681 EXPECT_FALSE(bridge()->target_fullscreen_state());
683 [center postNotificationName:NSWindowDidExitFullScreenNotification 682 [center postNotificationName:NSWindowDidExitFullScreenNotification
684 object:window]; 683 object:window];
685 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change. 684 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change.
686 EXPECT_FALSE(bridge()->target_fullscreen_state()); 685 EXPECT_FALSE(bridge()->target_fullscreen_state());
687 686
688 widget_->CloseNow(); 687 widget_->CloseNow();
689 } 688 }
690 689
691 } // namespace test 690 } // namespace test
692 } // namespace views 691 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/cocoa/views_nswindow_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698