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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 | 410 |
413 EXPECT_TRUE(widget->IsMinimized()); | 411 EXPECT_TRUE(widget->IsMinimized()); |
414 EXPECT_FALSE(widget->IsVisible()); | 412 EXPECT_FALSE(widget->IsVisible()); |
415 EXPECT_FALSE(child_widget->IsVisible()); | 413 EXPECT_FALSE(child_widget->IsVisible()); |
416 | 414 |
417 // Restore parent window as AppController does. | 415 // Restore parent window as AppController does. |
418 [ns_window makeKeyAndOrderFront:nil]; | 416 [ns_window makeKeyAndOrderFront:nil]; |
419 | 417 |
420 // Wait and check that child is really visible. | 418 // Wait and check that child is really visible. |
421 // TODO(kirr): remove the fixed delay. | 419 // TODO(kirr): remove the fixed delay. |
422 base::MessageLoop::current()->PostDelayedTask( | 420 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
423 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 421 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
424 base::TimeDelta::FromSeconds(2)); | 422 base::TimeDelta::FromSeconds(2)); |
425 base::MessageLoop::current()->Run(); | 423 base::RunLoop().Run(); |
426 | 424 |
427 EXPECT_FALSE(widget->IsMinimized()); | 425 EXPECT_FALSE(widget->IsMinimized()); |
428 EXPECT_TRUE(widget->IsVisible()); | 426 EXPECT_TRUE(widget->IsVisible()); |
429 EXPECT_TRUE(child_widget->IsVisible()); | 427 EXPECT_TRUE(child_widget->IsVisible()); |
430 // Check that child window is visible. | 428 // Check that child window is visible. |
431 EXPECT_TRUE([child_ns_window occlusionState] & NSWindowOcclusionStateVisible); | 429 EXPECT_TRUE([child_ns_window occlusionState] & NSWindowOcclusionStateVisible); |
432 EXPECT_TRUE(IsWindowStackedAbove(child_widget, widget)); | 430 EXPECT_TRUE(IsWindowStackedAbove(child_widget, widget)); |
433 widget->Close(); | 431 widget->Close(); |
434 } | 432 } |
435 | 433 |
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 | 1697 |
1700 - (void)dealloc { | 1698 - (void)dealloc { |
1701 if (deallocFlag_) { | 1699 if (deallocFlag_) { |
1702 DCHECK(!*deallocFlag_); | 1700 DCHECK(!*deallocFlag_); |
1703 *deallocFlag_ = true; | 1701 *deallocFlag_ = true; |
1704 } | 1702 } |
1705 [super dealloc]; | 1703 [super dealloc]; |
1706 } | 1704 } |
1707 | 1705 |
1708 @end | 1706 @end |
OLD | NEW |