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/test/views_test_helper_mac.h" | 5 #include "ui/views/test/views_test_helper_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #import "base/mac/scoped_nsautorelease_pool.h" | 9 #import "base/mac/scoped_nsautorelease_pool.h" |
10 #include "ui/base/test/scoped_fake_full_keyboard_access.h" | 10 #include "ui/base/test/scoped_fake_full_keyboard_access.h" |
11 #include "ui/base/test/scoped_fake_nswindow_focus.h" | 11 #include "ui/base/test/scoped_fake_nswindow_focus.h" |
12 #include "ui/base/test/scoped_fake_nswindow_fullscreen.h" | 12 #include "ui/base/test/scoped_fake_nswindow_fullscreen.h" |
13 #include "ui/base/test/ui_controls.h" | 13 #include "ui/base/test/ui_controls.h" |
14 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 14 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
15 #include "ui/views/test/event_generator_delegate_mac.h" | 15 #include "ui/views/test/event_generator_delegate_mac.h" |
16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
17 | 17 |
18 namespace views { | 18 namespace views { |
19 | 19 |
20 // static | 20 // static |
21 ViewsTestHelper* ViewsTestHelper::Create( | 21 ViewsTestHelper* ViewsTestHelper::Create( |
22 base::MessageLoopForUI* message_loop, | |
23 ui::ContextFactory* context_factory, | 22 ui::ContextFactory* context_factory, |
24 ui::ContextFactoryPrivate* context_factory_private) { | 23 ui::ContextFactoryPrivate* context_factory_private) { |
25 return new ViewsTestHelperMac; | 24 return new ViewsTestHelperMac; |
26 } | 25 } |
27 | 26 |
28 ViewsTestHelperMac::ViewsTestHelperMac() | 27 ViewsTestHelperMac::ViewsTestHelperMac() |
29 : zero_duration_mode_(new ui::ScopedAnimationDurationScaleMode( | 28 : zero_duration_mode_(new ui::ScopedAnimationDurationScaleMode( |
30 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)) { | 29 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)) { |
31 test::InitializeMacEventGeneratorDelegate(); | 30 test::InitializeMacEventGeneratorDelegate(); |
32 | 31 |
(...skipping 26 matching lines...) Expand all Loading... |
59 // this is handled automatically by views::Widget::CloseAllSecondaryWidgets(). | 58 // this is handled automatically by views::Widget::CloseAllSecondaryWidgets(). |
60 // Unit tests on Aura may create Widgets owned by a RootWindow that gets torn | 59 // Unit tests on Aura may create Widgets owned by a RootWindow that gets torn |
61 // down, but on Mac we need to be more explicit. | 60 // down, but on Mac we need to be more explicit. |
62 base::mac::ScopedNSAutoreleasePool pool; // Ensure the NSArray is released. | 61 base::mac::ScopedNSAutoreleasePool pool; // Ensure the NSArray is released. |
63 NSArray* native_windows = [NSApp windows]; | 62 NSArray* native_windows = [NSApp windows]; |
64 for (NSWindow* window : native_windows) | 63 for (NSWindow* window : native_windows) |
65 DCHECK(!Widget::GetWidgetForNativeWindow(window)) << "Widget not closed."; | 64 DCHECK(!Widget::GetWidgetForNativeWindow(window)) << "Widget not closed."; |
66 } | 65 } |
67 | 66 |
68 } // namespace views | 67 } // namespace views |
OLD | NEW |