OLD | NEW |
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 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
9 #import "testing/gtest_mac.h" | 9 #import "testing/gtest_mac.h" |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 returnCode_ = returnCode; | 62 returnCode_ = returnCode; |
63 } | 63 } |
64 | 64 |
65 @end | 65 @end |
66 | 66 |
67 class ConstrainedWindowSheetControllerTest : public CocoaTest { | 67 class ConstrainedWindowSheetControllerTest : public CocoaTest { |
68 protected: | 68 protected: |
69 virtual ~ConstrainedWindowSheetControllerTest() { | 69 virtual ~ConstrainedWindowSheetControllerTest() { |
70 } | 70 } |
71 | 71 |
72 virtual void SetUp() OVERRIDE { | 72 virtual void SetUp() override { |
73 CocoaTest::SetUp(); | 73 CocoaTest::SetUp(); |
74 | 74 |
75 // Center the window so that the sheet doesn't go offscreen. | 75 // Center the window so that the sheet doesn't go offscreen. |
76 [test_window() center]; | 76 [test_window() center]; |
77 | 77 |
78 // The real view setup is quite a few levels deep; recreate something | 78 // The real view setup is quite a few levels deep; recreate something |
79 // similar. | 79 // similar. |
80 NSRect dummy_rect = NSMakeRect(0, 0, 50, 50); | 80 NSRect dummy_rect = NSMakeRect(0, 0, 50, 50); |
81 tab_view_parent_ = [test_window() contentView]; | 81 tab_view_parent_ = [test_window() contentView]; |
82 for (int i = 0; i < 3; ++i) { | 82 for (int i = 0; i < 3; ++i) { |
(...skipping 23 matching lines...) Expand all Loading... |
106 [sheet_window_ setReleasedWhenClosed:NO]; | 106 [sheet_window_ setReleasedWhenClosed:NO]; |
107 sheet_.reset([[CustomConstrainedWindowSheet alloc] | 107 sheet_.reset([[CustomConstrainedWindowSheet alloc] |
108 initWithCustomWindow:sheet_window_]); | 108 initWithCustomWindow:sheet_window_]); |
109 | 109 |
110 controller_.reset([[ConstrainedWindowSheetController | 110 controller_.reset([[ConstrainedWindowSheetController |
111 controllerForParentWindow:test_window()] retain]); | 111 controllerForParentWindow:test_window()] retain]); |
112 EXPECT_TRUE(controller_); | 112 EXPECT_TRUE(controller_); |
113 EXPECT_FALSE([ConstrainedWindowSheetController controllerForSheet:sheet_]); | 113 EXPECT_FALSE([ConstrainedWindowSheetController controllerForSheet:sheet_]); |
114 } | 114 } |
115 | 115 |
116 virtual void TearDown() OVERRIDE { | 116 virtual void TearDown() override { |
117 sheet_.reset(); | 117 sheet_.reset(); |
118 sheet_window_.reset(); | 118 sheet_window_.reset(); |
119 CocoaTest::TearDown(); | 119 CocoaTest::TearDown(); |
120 } | 120 } |
121 | 121 |
122 void ActivateTabView(NSView* tab_view) { | 122 void ActivateTabView(NSView* tab_view) { |
123 for (NSView* view in tab_views_.get()) | 123 for (NSView* view in tab_views_.get()) |
124 [view removeFromSuperview]; | 124 [view removeFromSuperview]; |
125 [tab_view_parent_ addSubview:tab_view]; | 125 [tab_view_parent_ addSubview:tab_view]; |
126 active_tab_view_ = tab_view; | 126 active_tab_view_ = tab_view; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 EXPECT_FALSE([[alert window] isVisible]); | 308 EXPECT_FALSE([[alert window] isVisible]); |
309 [controller_ showSheet:system_sheet forParentView:tab1_]; | 309 [controller_ showSheet:system_sheet forParentView:tab1_]; |
310 EXPECT_FALSE([[alert window] isVisible]); | 310 EXPECT_FALSE([[alert window] isVisible]); |
311 | 311 |
312 ActivateTabView(tab1_); | 312 ActivateTabView(tab1_); |
313 EXPECT_TRUE([[alert window] isVisible]); | 313 EXPECT_TRUE([[alert window] isVisible]); |
314 EXPECT_EQ(1.0, [[alert window] alphaValue]); | 314 EXPECT_EQ(1.0, [[alert window] alphaValue]); |
315 | 315 |
316 [controller_ closeSheet:system_sheet]; | 316 [controller_ closeSheet:system_sheet]; |
317 } | 317 } |
OLD | NEW |