| 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(base::MessageLoopForUI* message_loop, | 21 ViewsTestHelper* ViewsTestHelper::Create( |
| 22 ui::ContextFactory* context_factory) { | 22 base::MessageLoopForUI* message_loop, |
| 23 ui::ContextFactory* context_factory, |
| 24 ui::ContextFactoryPrivate* context_factory_private) { |
| 23 return new ViewsTestHelperMac; | 25 return new ViewsTestHelperMac; |
| 24 } | 26 } |
| 25 | 27 |
| 26 ViewsTestHelperMac::ViewsTestHelperMac() | 28 ViewsTestHelperMac::ViewsTestHelperMac() |
| 27 : zero_duration_mode_(new ui::ScopedAnimationDurationScaleMode( | 29 : zero_duration_mode_(new ui::ScopedAnimationDurationScaleMode( |
| 28 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)) { | 30 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)) { |
| 29 test::InitializeMacEventGeneratorDelegate(); | 31 test::InitializeMacEventGeneratorDelegate(); |
| 30 | 32 |
| 31 // Unbundled applications (those without Info.plist) default to | 33 // Unbundled applications (those without Info.plist) default to |
| 32 // NSApplicationActivationPolicyProhibited, which prohibits the application | 34 // NSApplicationActivationPolicyProhibited, which prohibits the application |
| (...skipping 24 matching lines...) Expand all Loading... |
| 57 // this is handled automatically by views::Widget::CloseAllSecondaryWidgets(). | 59 // this is handled automatically by views::Widget::CloseAllSecondaryWidgets(). |
| 58 // Unit tests on Aura may create Widgets owned by a RootWindow that gets torn | 60 // Unit tests on Aura may create Widgets owned by a RootWindow that gets torn |
| 59 // down, but on Mac we need to be more explicit. | 61 // down, but on Mac we need to be more explicit. |
| 60 base::mac::ScopedNSAutoreleasePool pool; // Ensure the NSArray is released. | 62 base::mac::ScopedNSAutoreleasePool pool; // Ensure the NSArray is released. |
| 61 NSArray* native_windows = [NSApp windows]; | 63 NSArray* native_windows = [NSApp windows]; |
| 62 for (NSWindow* window : native_windows) | 64 for (NSWindow* window : native_windows) |
| 63 DCHECK(!Widget::GetWidgetForNativeWindow(window)) << "Widget not closed."; | 65 DCHECK(!Widget::GetWidgetForNativeWindow(window)) << "Widget not closed."; |
| 64 } | 66 } |
| 65 | 67 |
| 66 } // namespace views | 68 } // namespace views |
| OLD | NEW |