OLD | NEW |
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 #include "ui/views/widget/native_widget_mac.h" | 5 #include "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/mac_util.h" | 9 #import "base/mac/mac_util.h" |
10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 [view bitmapImageRepForCachingDisplayInRect:[view bounds]]; | 157 [view bitmapImageRepForCachingDisplayInRect:[view bounds]]; |
158 [view cacheDisplayInRect:[view bounds] toBitmapImageRep:bitmap]; | 158 [view cacheDisplayInRect:[view bounds] toBitmapImageRep:bitmap]; |
159 return [bitmap TIFFRepresentation]; | 159 return [bitmap TIFFRepresentation]; |
160 } | 160 } |
161 | 161 |
162 } // namespace | 162 } // namespace |
163 | 163 |
164 // Test that parent windows keep their traffic lights enabled when showing | 164 // Test that parent windows keep their traffic lights enabled when showing |
165 // dialogs. | 165 // dialogs. |
166 TEST_F(NativeWidgetMacInteractiveUITest, ParentWindowTrafficLights) { | 166 TEST_F(NativeWidgetMacInteractiveUITest, ParentWindowTrafficLights) { |
167 // Snow leopard doesn't have -[NSWindow _sharesParentKeyState]. | |
168 if (base::mac::IsOSSnowLeopard()) | |
169 return; | |
170 | |
171 Widget* parent_widget = CreateTopLevelPlatformWidget(); | 167 Widget* parent_widget = CreateTopLevelPlatformWidget(); |
172 parent_widget->SetBounds(gfx::Rect(100, 100, 100, 100)); | 168 parent_widget->SetBounds(gfx::Rect(100, 100, 100, 100)); |
173 ShowKeyWindow(parent_widget); | 169 ShowKeyWindow(parent_widget); |
174 | 170 |
175 NSWindow* parent = parent_widget->GetNativeWindow(); | 171 NSWindow* parent = parent_widget->GetNativeWindow(); |
176 EXPECT_TRUE([parent isMainWindow]); | 172 EXPECT_TRUE([parent isMainWindow]); |
177 | 173 |
178 NSButton* button = [parent standardWindowButton:NSWindowCloseButton]; | 174 NSButton* button = [parent standardWindowButton:NSWindowCloseButton]; |
179 EXPECT_TRUE(button); | 175 EXPECT_TRUE(button); |
180 NSData* active_button_image = ViewAsTIFF(button); | 176 NSData* active_button_image = ViewAsTIFF(button); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 other_widget->CloseNow(); | 211 other_widget->CloseNow(); |
216 parent_widget->CloseNow(); | 212 parent_widget->CloseNow(); |
217 } | 213 } |
218 | 214 |
219 INSTANTIATE_TEST_CASE_P(NativeWidgetMacInteractiveUITestInstance, | 215 INSTANTIATE_TEST_CASE_P(NativeWidgetMacInteractiveUITestInstance, |
220 NativeWidgetMacInteractiveUITest, | 216 NativeWidgetMacInteractiveUITest, |
221 ::testing::Bool()); | 217 ::testing::Bool()); |
222 | 218 |
223 } // namespace test | 219 } // namespace test |
224 } // namespace views | 220 } // namespace views |
OLD | NEW |