OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "ui/compositor/compositor.h" | 16 #include "ui/compositor/compositor.h" |
| 17 #include "ui/compositor/test/draw_waiter_for_test.h" |
17 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
18 #include "ui/gfx/x/x11_types.h" | 19 #include "ui/gfx/x/x11_types.h" |
19 | 20 |
20 namespace ui { | 21 namespace ui { |
21 | 22 |
22 class TestCompositorHostX11 : public TestCompositorHost { | 23 class TestCompositorHostX11 : public TestCompositorHost { |
23 public: | 24 public: |
24 TestCompositorHostX11(const gfx::Rect& bounds, | 25 TestCompositorHostX11(const gfx::Rect& bounds, |
25 ui::ContextFactory* context_factory); | 26 ui::ContextFactory* context_factory); |
26 virtual ~TestCompositorHostX11(); | 27 virtual ~TestCompositorHostX11(); |
27 | 28 |
28 private: | 29 private: |
29 // Overridden from TestCompositorHost: | 30 // Overridden from TestCompositorHost: |
30 virtual void Show() OVERRIDE; | 31 virtual void Show() OVERRIDE; |
31 virtual ui::Compositor* GetCompositor() OVERRIDE; | 32 virtual ui::Compositor* GetCompositor() OVERRIDE; |
32 | 33 |
33 void Draw(); | |
34 | |
35 gfx::Rect bounds_; | 34 gfx::Rect bounds_; |
36 | 35 |
37 ui::ContextFactory* context_factory_; | 36 ui::ContextFactory* context_factory_; |
38 | 37 |
39 scoped_ptr<ui::Compositor> compositor_; | 38 scoped_ptr<ui::Compositor> compositor_; |
40 | 39 |
41 XID window_; | 40 XID window_; |
42 | 41 |
43 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostX11); | 42 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostX11); |
44 }; | 43 }; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 break; | 75 break; |
77 } | 76 } |
78 compositor_.reset(new ui::Compositor(window_, context_factory_)); | 77 compositor_.reset(new ui::Compositor(window_, context_factory_)); |
79 compositor_->SetScaleAndSize(1.0f, bounds_.size()); | 78 compositor_->SetScaleAndSize(1.0f, bounds_.size()); |
80 } | 79 } |
81 | 80 |
82 ui::Compositor* TestCompositorHostX11::GetCompositor() { | 81 ui::Compositor* TestCompositorHostX11::GetCompositor() { |
83 return compositor_.get(); | 82 return compositor_.get(); |
84 } | 83 } |
85 | 84 |
86 void TestCompositorHostX11::Draw() { | |
87 if (compositor_.get()) | |
88 compositor_->Draw(); | |
89 } | |
90 | |
91 // static | 85 // static |
92 TestCompositorHost* TestCompositorHost::Create( | 86 TestCompositorHost* TestCompositorHost::Create( |
93 const gfx::Rect& bounds, | 87 const gfx::Rect& bounds, |
94 ui::ContextFactory* context_factory) { | 88 ui::ContextFactory* context_factory) { |
95 return new TestCompositorHostX11(bounds, context_factory); | 89 return new TestCompositorHostX11(bounds, context_factory); |
96 } | 90 } |
97 | 91 |
98 } // namespace ui | 92 } // namespace ui |
OLD | NEW |