| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/compositor/test/test_compositor_host.h" | 5 #include "ui/compositor/test/test_compositor_host.h" |
| 6 | 6 |
| 7 #import <AppKit/NSApplication.h> | 7 #import <AppKit/NSApplication.h> |
| 8 #import <AppKit/NSOpenGL.h> | 8 #import <AppKit/NSOpenGL.h> |
| 9 #import <AppKit/NSView.h> | 9 #import <AppKit/NSView.h> |
| 10 #import <AppKit/NSWindow.h> | 10 #import <AppKit/NSWindow.h> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 // Tests that use the AppKit framework need to have the NSApplication | 66 // Tests that use the AppKit framework need to have the NSApplication |
| 67 // initialized prior to doing anything with display objects such as windows, | 67 // initialized prior to doing anything with display objects such as windows, |
| 68 // views, or controls. | 68 // views, or controls. |
| 69 class AppKitHost : public FoundationHost { | 69 class AppKitHost : public FoundationHost { |
| 70 protected: | 70 protected: |
| 71 AppKitHost() { | 71 AppKitHost() { |
| 72 [NSApplication sharedApplication]; | 72 [NSApplication sharedApplication]; |
| 73 } | 73 } |
| 74 virtual ~AppKitHost() { | 74 ~AppKitHost() override {} |
| 75 } | |
| 76 private: | 75 private: |
| 77 DISALLOW_COPY_AND_ASSIGN(AppKitHost); | 76 DISALLOW_COPY_AND_ASSIGN(AppKitHost); |
| 78 }; | 77 }; |
| 79 | 78 |
| 80 // TestCompositorHostMac provides a window surface and a coordinated compositor | 79 // TestCompositorHostMac provides a window surface and a coordinated compositor |
| 81 // for use in the compositor unit tests. | 80 // for use in the compositor unit tests. |
| 82 class TestCompositorHostMac : public TestCompositorHost, | 81 class TestCompositorHostMac : public TestCompositorHost, |
| 83 public AppKitHost { | 82 public AppKitHost { |
| 84 public: | 83 public: |
| 85 TestCompositorHostMac(const gfx::Rect& bounds, | 84 TestCompositorHostMac(const gfx::Rect& bounds, |
| 86 ui::ContextFactory* context_factory); | 85 ui::ContextFactory* context_factory); |
| 87 virtual ~TestCompositorHostMac(); | 86 ~TestCompositorHostMac() override; |
| 88 | 87 |
| 89 private: | 88 private: |
| 90 // TestCompositorHost: | 89 // TestCompositorHost: |
| 91 virtual void Show() override; | 90 void Show() override; |
| 92 virtual ui::Compositor* GetCompositor() override; | 91 ui::Compositor* GetCompositor() override; |
| 93 | 92 |
| 94 gfx::Rect bounds_; | 93 gfx::Rect bounds_; |
| 95 | 94 |
| 96 ui::ContextFactory* context_factory_; | 95 ui::ContextFactory* context_factory_; |
| 97 | 96 |
| 98 scoped_ptr<ui::Compositor> compositor_; | 97 scoped_ptr<ui::Compositor> compositor_; |
| 99 | 98 |
| 100 // Owned. Released when window is closed. | 99 // Owned. Released when window is closed. |
| 101 NSWindow* window_; | 100 NSWindow* window_; |
| 102 | 101 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 144 } |
| 146 | 145 |
| 147 // static | 146 // static |
| 148 TestCompositorHost* TestCompositorHost::Create( | 147 TestCompositorHost* TestCompositorHost::Create( |
| 149 const gfx::Rect& bounds, | 148 const gfx::Rect& bounds, |
| 150 ui::ContextFactory* context_factory) { | 149 ui::ContextFactory* context_factory) { |
| 151 return new TestCompositorHostMac(bounds, context_factory); | 150 return new TestCompositorHostMac(bounds, context_factory); |
| 152 } | 151 } |
| 153 | 152 |
| 154 } // namespace ui | 153 } // namespace ui |
| OLD | NEW |