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 virtual ~TestCompositorHostX11(); | 26 virtual ~TestCompositorHostX11(); |
26 | 27 |
27 private: | 28 private: |
28 // Overridden from TestCompositorHost: | 29 // Overridden from TestCompositorHost: |
29 virtual void Show() OVERRIDE; | 30 virtual void Show() OVERRIDE; |
30 virtual ui::Compositor* GetCompositor() OVERRIDE; | 31 virtual ui::Compositor* GetCompositor() OVERRIDE; |
31 | 32 |
32 void Draw(); | |
33 | |
34 gfx::Rect bounds_; | 33 gfx::Rect bounds_; |
35 | 34 |
36 scoped_ptr<ui::Compositor> compositor_; | 35 scoped_ptr<ui::Compositor> compositor_; |
37 | 36 |
38 XID window_; | 37 XID window_; |
39 | 38 |
40 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostX11); | 39 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostX11); |
41 }; | 40 }; |
42 | 41 |
43 TestCompositorHostX11::TestCompositorHostX11(const gfx::Rect& bounds) | 42 TestCompositorHostX11::TestCompositorHostX11(const gfx::Rect& bounds) |
(...skipping 26 matching lines...) Expand all Loading... |
70 break; | 69 break; |
71 } | 70 } |
72 compositor_.reset(new ui::Compositor(window_)); | 71 compositor_.reset(new ui::Compositor(window_)); |
73 compositor_->SetScaleAndSize(1.0f, bounds_.size()); | 72 compositor_->SetScaleAndSize(1.0f, bounds_.size()); |
74 } | 73 } |
75 | 74 |
76 ui::Compositor* TestCompositorHostX11::GetCompositor() { | 75 ui::Compositor* TestCompositorHostX11::GetCompositor() { |
77 return compositor_.get(); | 76 return compositor_.get(); |
78 } | 77 } |
79 | 78 |
80 void TestCompositorHostX11::Draw() { | |
81 if (compositor_.get()) | |
82 compositor_->Draw(); | |
83 } | |
84 | |
85 // static | 79 // static |
86 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { | 80 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { |
87 return new TestCompositorHostX11(bounds); | 81 return new TestCompositorHostX11(bounds); |
88 } | 82 } |
89 | 83 |
90 } // namespace ui | 84 } // namespace ui |
OLD | NEW |