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

Side by Side Diff: ui/views/widget/native_widget_mac_unittest.mm

Issue 2393843002: MacViews: Implement CloseNow() as just -[NSWindow close]. (Closed)
Patch Set: Selfnits Created 4 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
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/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_nsautorelease_pool.h" 10 #import "base/mac/scoped_nsautorelease_pool.h"
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 EXPECT_TRUE(parent_nswindow_); 1148 EXPECT_TRUE(parent_nswindow_);
1149 EXPECT_TRUE([parent_nswindow_ delegate]); 1149 EXPECT_TRUE([parent_nswindow_ delegate]);
1150 } 1150 }
1151 1151
1152 ~ParentCloseMonitor() override { 1152 ~ParentCloseMonitor() override {
1153 EXPECT_TRUE(child_closed_); // Otherwise the observer wasn't removed. 1153 EXPECT_TRUE(child_closed_); // Otherwise the observer wasn't removed.
1154 } 1154 }
1155 1155
1156 void OnWidgetDestroying(Widget* child) override { 1156 void OnWidgetDestroying(Widget* child) override {
1157 // Upon a parent-triggered close, the NSWindow relationship will already be 1157 // Upon a parent-triggered close, the NSWindow relationship will already be
1158 // removed. The parent should still be open (children are always closed 1158 // removed. The parent should still be open (children are always closed
karandeepb 2016/10/18 10:00:29 "the NSWindow relation will already be removed". U
tapted 2016/10/19 06:20:25 Done. And actually added a OnWidgetDestroyed() ove
1159 // first), but not have a delegate (since it is being torn down). 1159 // first), but not have a delegate (since it is being torn down).
1160 EXPECT_FALSE([child->GetNativeWindow() parentWindow]); 1160 EXPECT_TRUE([child->GetNativeWindow() parentWindow]);
1161 EXPECT_TRUE([parent_nswindow_ isVisible]); 1161 EXPECT_TRUE([parent_nswindow_ isVisible]);
1162 EXPECT_FALSE([parent_nswindow_ delegate]); 1162 EXPECT_FALSE([parent_nswindow_ delegate]);
1163 1163
1164 EXPECT_FALSE(child_closed_); 1164 EXPECT_FALSE(child_closed_);
1165 child->RemoveObserver(this); 1165 child->RemoveObserver(this);
1166 child_closed_ = true; 1166 child_closed_ = true;
1167 } 1167 }
1168 1168
1169 bool child_closed() const { return child_closed_; } 1169 bool child_closed() const { return child_closed_; }
1170 1170
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 1793
1794 - (void)dealloc { 1794 - (void)dealloc {
1795 if (deallocFlag_) { 1795 if (deallocFlag_) {
1796 DCHECK(!*deallocFlag_); 1796 DCHECK(!*deallocFlag_);
1797 *deallocFlag_ = true; 1797 *deallocFlag_ = true;
1798 } 1798 }
1799 [super dealloc]; 1799 [super dealloc];
1800 } 1800 }
1801 1801
1802 @end 1802 @end
OLDNEW
« ui/views/widget/native_widget_mac.mm ('K') | « ui/views/widget/native_widget_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698