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

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

Issue 1775223002: Prepare chrome/ for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile errors. Fix null-window error. 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
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 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h" 5 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/mac/sdk_forward_declarations.h"
9 #include "base/macros.h" 10 #include "base/macros.h"
10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" 11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
11 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h" 12 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh eet.h"
12 #import "testing/gtest_mac.h" 13 #import "testing/gtest_mac.h"
13 14
14 namespace { 15 namespace {
15 16
16 const int kSystemSheetReturnCode = 77; 17 const int kSystemSheetReturnCode = 77;
17 18
18 } // namespace 19 } // namespace
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 153
153 [controller hideSheet]; 154 [controller hideSheet];
154 CustomConstrainedWindowSheet* sheet = 155 CustomConstrainedWindowSheet* sheet =
155 [sheets_ objectAtIndex:[tab_views_ indexOfObject:active_tab_view_]]; 156 [sheets_ objectAtIndex:[tab_views_ indexOfObject:active_tab_view_]];
156 EXPECT_TRUE(sheet); 157 EXPECT_TRUE(sheet);
157 [controller showSheet:sheet forParentView:active_tab_view_]; 158 [controller showSheet:sheet forParentView:active_tab_view_];
158 } 159 }
159 160
160 NSRect GetViewFrameInScreenCoordinates(NSView* view) { 161 NSRect GetViewFrameInScreenCoordinates(NSView* view) {
161 NSRect rect = [view convertRect:[view bounds] toView:nil]; 162 NSRect rect = [view convertRect:[view bounds] toView:nil];
162 rect.origin = [[view window] convertBaseToScreen:rect.origin]; 163 rect = [[view window] convertRectToScreen:rect];
163 return rect; 164 return rect;
164 } 165 }
165 166
166 void VerifySheetXPosition(NSRect sheet_frame, NSView* parent_view) { 167 void VerifySheetXPosition(NSRect sheet_frame, NSView* parent_view) {
167 NSRect parent_frame = GetViewFrameInScreenCoordinates(parent_view); 168 NSRect parent_frame = GetViewFrameInScreenCoordinates(parent_view);
168 CGFloat expected_x = NSMinX(parent_frame) + 169 CGFloat expected_x = NSMinX(parent_frame) +
169 (NSWidth(parent_frame) - NSWidth(sheet_frame)) / 2.0; 170 (NSWidth(parent_frame) - NSWidth(sheet_frame)) / 2.0;
170 EXPECT_EQ(expected_x, NSMinX(sheet_frame)); 171 EXPECT_EQ(expected_x, NSMinX(sheet_frame));
171 } 172 }
172 173
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 [system_sheet setAlert:alert]; 311 [system_sheet setAlert:alert];
311 312
312 EXPECT_FALSE([[alert window] isVisible]); 313 EXPECT_FALSE([[alert window] isVisible]);
313 [controller_ showSheet:system_sheet forParentView:active_tab_view_]; 314 [controller_ showSheet:system_sheet forParentView:active_tab_view_];
314 EXPECT_TRUE([[alert window] isVisible]); 315 EXPECT_TRUE([[alert window] isVisible]);
315 316
316 [controller_ closeSheet:system_sheet]; 317 [controller_ closeSheet:system_sheet];
317 EXPECT_FALSE([[alert window] isVisible]); 318 EXPECT_FALSE([[alert window] isVisible]);
318 EXPECT_EQ(kSystemSheetReturnCode, [system_sheet returnCode]); 319 EXPECT_EQ(kSystemSheetReturnCode, [system_sheet returnCode]);
319 } 320 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698