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

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

Issue 1772153002: Fix BridgedNativeWidgetTest test crashes after r379525 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also fix NativeWidgetMacTest.NonWidgetParent Created 4 years, 9 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 | « no previous file | ui/views/widget/native_widget_mac_unittest.mm » ('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/mac_util.h" 10 #import "base/mac/mac_util.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 EXPECT_TRUE([window delegate]); 272 EXPECT_TRUE([window delegate]);
273 bridge()->SetRootView(view_.get()); 273 bridge()->SetRootView(view_.get());
274 ns_view_ = bridge()->ns_view(); 274 ns_view_ = bridge()->ns_view();
275 275
276 // Pretend it has been shown via NativeWidgetMac::Show(). 276 // Pretend it has been shown via NativeWidgetMac::Show().
277 [window orderFront:nil]; 277 [window orderFront:nil];
278 [test_window() makePretendKeyWindowAndSetFirstResponder:bridge()->ns_view()]; 278 [test_window() makePretendKeyWindowAndSetFirstResponder:bridge()->ns_view()];
279 } 279 }
280 280
281 void BridgedNativeWidgetTest::TearDown() { 281 void BridgedNativeWidgetTest::TearDown() {
282 if (bridge())
283 bridge()->SetRootView(nullptr);
282 view_.reset(); 284 view_.reset();
283 BridgedNativeWidgetTestBase::TearDown(); 285 BridgedNativeWidgetTestBase::TearDown();
284 } 286 }
285 287
286 // The TEST_VIEW macro expects the view it's testing to have a superview. In 288 // The TEST_VIEW macro expects the view it's testing to have a superview. In
287 // these tests, the NSView bridge is a contentView, at the root. These mimic 289 // these tests, the NSView bridge is a contentView, at the root. These mimic
288 // what TEST_VIEW usually does. 290 // what TEST_VIEW usually does.
289 TEST_F(BridgedNativeWidgetTest, BridgedNativeWidgetTest_TestViewAddRemove) { 291 TEST_F(BridgedNativeWidgetTest, BridgedNativeWidgetTest_TestViewAddRemove) {
290 base::scoped_nsobject<BridgedContentView> view([bridge()->ns_view() retain]); 292 base::scoped_nsobject<BridgedContentView> view([bridge()->ns_view() retain]);
291 EXPECT_NSEQ([test_window() contentView], view); 293 EXPECT_NSEQ([test_window() contentView], view);
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 [center postNotificationName:NSWindowDidExitFullScreenNotification 747 [center postNotificationName:NSWindowDidExitFullScreenNotification
746 object:window]; 748 object:window];
747 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change. 749 EXPECT_EQ(1, [window ignoredToggleFullScreenCount]); // No change.
748 EXPECT_FALSE(bridge()->target_fullscreen_state()); 750 EXPECT_FALSE(bridge()->target_fullscreen_state());
749 751
750 widget_->CloseNow(); 752 widget_->CloseNow();
751 } 753 }
752 754
753 } // namespace test 755 } // namespace test
754 } // namespace views 756 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/native_widget_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698