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

Side by Side Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac_browsertest.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" 5 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 controller_ = [BrowserWindowController browserWindowControllerForWindow: 59 controller_ = [BrowserWindowController browserWindowControllerForWindow:
60 browser()->window()->GetNativeWindow()]; 60 browser()->window()->GetNativeWindow()];
61 EXPECT_TRUE(controller_); 61 EXPECT_TRUE(controller_);
62 tab_view0_ = [[controller_ tabStripController] viewAtIndex:0]; 62 tab_view0_ = [[controller_ tabStripController] viewAtIndex:0];
63 EXPECT_TRUE(tab_view0_); 63 EXPECT_TRUE(tab_view0_);
64 tab_view1_ = [[controller_ tabStripController] viewAtIndex:1]; 64 tab_view1_ = [[controller_ tabStripController] viewAtIndex:1];
65 EXPECT_TRUE(tab_view1_); 65 EXPECT_TRUE(tab_view1_);
66 } 66 }
67 67
68 protected: 68 protected:
69 scoped_nsobject<CustomConstrainedWindowSheet> sheet_; 69 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet_;
70 scoped_nsobject<NSWindow> sheet_window_; 70 base::scoped_nsobject<NSWindow> sheet_window_;
71 content::WebContents* tab0_; 71 content::WebContents* tab0_;
72 content::WebContents* tab1_; 72 content::WebContents* tab1_;
73 BrowserWindowController* controller_; 73 BrowserWindowController* controller_;
74 NSView* tab_view0_; 74 NSView* tab_view0_;
75 NSView* tab_view1_; 75 NSView* tab_view1_;
76 }; 76 };
77 77
78 // Test that a sheet added to a inactive tab is not shown until the 78 // Test that a sheet added to a inactive tab is not shown until the
79 // tab is activated. 79 // tab is activated.
80 IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, ShowInInactiveTab) { 80 IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, ShowInInactiveTab) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 dialog.CloseWebContentsModalDialog(); 130 dialog.CloseWebContentsModalDialog();
131 } 131 }
132 132
133 // Test that closing a browser window with a sheet works. 133 // Test that closing a browser window with a sheet works.
134 IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, BrowserWindowClose) { 134 IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, BrowserWindowClose) {
135 NiceMock<ConstrainedWindowDelegateMock> delegate; 135 NiceMock<ConstrainedWindowDelegateMock> delegate;
136 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_); 136 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_);
137 EXPECT_EQ(1.0, [sheet_window_ alphaValue]); 137 EXPECT_EQ(1.0, [sheet_window_ alphaValue]);
138 138
139 // Close the browser window. 139 // Close the browser window.
140 scoped_nsobject<NSWindow> browser_window( 140 base::scoped_nsobject<NSWindow> browser_window(
141 [browser()->window()->GetNativeWindow() retain]); 141 [browser()->window()->GetNativeWindow() retain]);
142 EXPECT_TRUE([browser_window isVisible]); 142 EXPECT_TRUE([browser_window isVisible]);
143 [browser()->window()->GetNativeWindow() performClose:nil]; 143 [browser()->window()->GetNativeWindow() performClose:nil];
144 EXPECT_FALSE([browser_window isVisible]); 144 EXPECT_FALSE([browser_window isVisible]);
145 } 145 }
146 146
147 // Test that closing a tab with a sheet works. 147 // Test that closing a tab with a sheet works.
148 IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, TabClose) { 148 IN_PROC_BROWSER_TEST_F(ConstrainedWindowMacTest, TabClose) {
149 NiceMock<ConstrainedWindowDelegateMock> delegate; 149 NiceMock<ConstrainedWindowDelegateMock> delegate;
150 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_); 150 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_);
(...skipping 12 matching lines...) Expand all
163 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); 163 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
164 164
165 // Dialog will delete it self when closed. 165 // Dialog will delete it self when closed.
166 NiceMock<ConstrainedWindowDelegateMock> delegate; 166 NiceMock<ConstrainedWindowDelegateMock> delegate;
167 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_); 167 ConstrainedWindowMac dialog(&delegate, tab1_, sheet_);
168 168
169 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN)); 169 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
170 170
171 dialog.CloseWebContentsModalDialog(); 171 dialog.CloseWebContentsModalDialog();
172 } 172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698