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 #import "ui/views/widget/native_widget_mac.h" | 5 #import "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/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
10 #import "base/mac/scoped_nsautorelease_pool.h" | 10 #import "base/mac/scoped_nsautorelease_pool.h" |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 [window setContentSize:NSMakeSize(123, 456)]; | 1369 [window setContentSize:NSMakeSize(123, 456)]; |
1370 // A "late" frame swap at the old size should do nothing. | 1370 // A "late" frame swap at the old size should do nothing. |
1371 test_api.SimulateFrameSwap(rect.size()); | 1371 test_api.SimulateFrameSwap(rect.size()); |
1372 EXPECT_EQ(1, [window invalidateShadowCount]); | 1372 EXPECT_EQ(1, [window invalidateShadowCount]); |
1373 | 1373 |
1374 test_api.SimulateFrameSwap(gfx::Size(123, 456)); | 1374 test_api.SimulateFrameSwap(gfx::Size(123, 456)); |
1375 EXPECT_EQ(2, [window invalidateShadowCount]); | 1375 EXPECT_EQ(2, [window invalidateShadowCount]); |
1376 test_api.SimulateFrameSwap(gfx::Size(123, 456)); | 1376 test_api.SimulateFrameSwap(gfx::Size(123, 456)); |
1377 EXPECT_EQ(2, [window invalidateShadowCount]); | 1377 EXPECT_EQ(2, [window invalidateShadowCount]); |
1378 | 1378 |
| 1379 // Hiding the window does not require shadow invalidation. |
| 1380 widget->Hide(); |
| 1381 test_api.SimulateFrameSwap(gfx::Size(123, 456)); |
| 1382 EXPECT_EQ(2, [window invalidateShadowCount]); |
| 1383 |
| 1384 // Showing a translucent window after hiding it, should trigger shadow |
| 1385 // invalidation. |
| 1386 widget->Show(); |
| 1387 test_api.SimulateFrameSwap(gfx::Size(123, 456)); |
| 1388 EXPECT_EQ(3, [window invalidateShadowCount]); |
| 1389 |
1379 widget->CloseNow(); | 1390 widget->CloseNow(); |
1380 } | 1391 } |
1381 | 1392 |
1382 // Test that the contentView opacity corresponds to the window type. | 1393 // Test that the contentView opacity corresponds to the window type. |
1383 TEST_F(NativeWidgetMacTest, ContentOpacity) { | 1394 TEST_F(NativeWidgetMacTest, ContentOpacity) { |
1384 NativeWidgetMacTestWindow* window; | 1395 NativeWidgetMacTestWindow* window; |
1385 Widget::InitParams init_params = | 1396 Widget::InitParams init_params = |
1386 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 1397 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
1387 | 1398 |
1388 EXPECT_EQ(init_params.opacity, Widget::InitParams::INFER_OPACITY); | 1399 EXPECT_EQ(init_params.opacity, Widget::InitParams::INFER_OPACITY); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 | 1793 |
1783 - (void)dealloc { | 1794 - (void)dealloc { |
1784 if (deallocFlag_) { | 1795 if (deallocFlag_) { |
1785 DCHECK(!*deallocFlag_); | 1796 DCHECK(!*deallocFlag_); |
1786 *deallocFlag_ = true; | 1797 *deallocFlag_ = true; |
1787 } | 1798 } |
1788 [super dealloc]; | 1799 [super dealloc]; |
1789 } | 1800 } |
1790 | 1801 |
1791 @end | 1802 @end |
OLD | NEW |