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 #include "base/location.h" | |
10 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #import "base/mac/scoped_nsautorelease_pool.h" |
11 #import "base/mac/scoped_nsobject.h" | 11 #import "base/mac/scoped_nsobject.h" |
12 #import "base/mac/scoped_nsautorelease_pool.h" | |
13 #import "base/mac/scoped_objc_class_swizzler.h" | 12 #import "base/mac/scoped_objc_class_swizzler.h" |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
16 #include "base/single_thread_task_runner.h" | |
17 #include "base/strings/sys_string_conversions.h" | 15 #include "base/strings/sys_string_conversions.h" |
18 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
19 #include "base/test/test_timeouts.h" | 17 #include "base/test/test_timeouts.h" |
20 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
21 #import "testing/gtest_mac.h" | 19 #import "testing/gtest_mac.h" |
22 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
23 #include "third_party/skia/include/core/SkCanvas.h" | 21 #include "third_party/skia/include/core/SkCanvas.h" |
24 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h" | 22 #import "ui/base/cocoa/constrained_window/constrained_window_animation.h" |
25 #import "ui/base/cocoa/window_size_constants.h" | 23 #import "ui/base/cocoa/window_size_constants.h" |
26 #import "ui/base/test/scoped_fake_full_keyboard_access.h" | 24 #import "ui/base/test/scoped_fake_full_keyboard_access.h" |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 433 |
436 EXPECT_TRUE(widget->IsMinimized()); | 434 EXPECT_TRUE(widget->IsMinimized()); |
437 EXPECT_FALSE(widget->IsVisible()); | 435 EXPECT_FALSE(widget->IsVisible()); |
438 EXPECT_FALSE(child_widget->IsVisible()); | 436 EXPECT_FALSE(child_widget->IsVisible()); |
439 | 437 |
440 // Restore parent window as AppController does. | 438 // Restore parent window as AppController does. |
441 [ns_window makeKeyAndOrderFront:nil]; | 439 [ns_window makeKeyAndOrderFront:nil]; |
442 | 440 |
443 // Wait and check that child is really visible. | 441 // Wait and check that child is really visible. |
444 // TODO(kirr): remove the fixed delay. | 442 // TODO(kirr): remove the fixed delay. |
445 base::MessageLoop::current()->PostDelayedTask( | 443 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
446 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 444 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
447 base::TimeDelta::FromSeconds(2)); | 445 base::TimeDelta::FromSeconds(2)); |
448 base::MessageLoop::current()->Run(); | 446 base::RunLoop().Run(); |
449 | 447 |
450 EXPECT_FALSE(widget->IsMinimized()); | 448 EXPECT_FALSE(widget->IsMinimized()); |
451 EXPECT_TRUE(widget->IsVisible()); | 449 EXPECT_TRUE(widget->IsVisible()); |
452 EXPECT_TRUE(child_widget->IsVisible()); | 450 EXPECT_TRUE(child_widget->IsVisible()); |
453 // Check that child window is visible. | 451 // Check that child window is visible. |
454 EXPECT_TRUE([child_ns_window occlusionState] & NSWindowOcclusionStateVisible); | 452 EXPECT_TRUE([child_ns_window occlusionState] & NSWindowOcclusionStateVisible); |
455 EXPECT_TRUE(IsWindowStackedAbove(child_widget, widget)); | 453 EXPECT_TRUE(IsWindowStackedAbove(child_widget, widget)); |
456 widget->Close(); | 454 widget->Close(); |
457 } | 455 } |
458 | 456 |
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 | 1757 |
1760 - (void)dealloc { | 1758 - (void)dealloc { |
1761 if (deallocFlag_) { | 1759 if (deallocFlag_) { |
1762 DCHECK(!*deallocFlag_); | 1760 DCHECK(!*deallocFlag_); |
1763 *deallocFlag_ = true; | 1761 *deallocFlag_ = true; |
1764 } | 1762 } |
1765 [super dealloc]; | 1763 [super dealloc]; |
1766 } | 1764 } |
1767 | 1765 |
1768 @end | 1766 @end |
OLD | NEW |