Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: ui/gfx/compositor/test_compositor.h

Issue 8395043: Fix up compositor mocking. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "" Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_ 5 #ifndef UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_
6 #define UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_ 6 #define UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "ui/gfx/compositor/compositor.h" 12 #include "ui/gfx/compositor/compositor.h"
13 #include "ui/gfx/compositor/compositor_export.h"
13 14
14 namespace ui { 15 namespace ui {
15 16
16 class TestCompositorDelegate; 17 class TestCompositorDelegate;
17 18
18 // Trivial Compositor implementation that creates Textures of type TestTexture. 19 // Trivial Compositor implementation that creates Textures of type TestTexture.
19 class TestCompositor : public ui::Compositor { 20 class COMPOSITOR_EXPORT TestCompositor : public ui::Compositor {
20 public: 21 public:
21 explicit TestCompositor(CompositorDelegate* owner); 22 explicit TestCompositor(CompositorDelegate* owner);
22 virtual ~TestCompositor(); 23 virtual ~TestCompositor();
23 24
24 // ui::Compositor: 25 // ui::Compositor:
25 virtual ui::Texture* CreateTexture() OVERRIDE; 26 virtual ui::Texture* CreateTexture() OVERRIDE;
26 virtual void OnNotifyStart(bool clear) OVERRIDE; 27 virtual void OnNotifyStart(bool clear) OVERRIDE;
27 virtual void OnNotifyEnd() OVERRIDE; 28 virtual void OnNotifyEnd() OVERRIDE;
28 virtual void Blur(const gfx::Rect& bounds) OVERRIDE; 29 virtual void Blur(const gfx::Rect& bounds) OVERRIDE;
29 virtual void DrawTree() OVERRIDE; 30 virtual void DrawTree() OVERRIDE;
30 31
31 // A simple factory that creates a test compositor with a given delegate 32 // A simple factory that creates a test compositor with a given delegate
32 static ui::Compositor* Create(ui::CompositorDelegate* owner); 33 static ui::Compositor* Create(ui::CompositorDelegate* owner);
33 34
35 // Called by tests that want to use a mocked compositor.
36 // Implementation is no-oped on platforms that don't use a compositor.
37 static void SetupTestCompositor();
38
34 protected: 39 protected:
35 virtual void OnWidgetSizeChanged() OVERRIDE; 40 virtual void OnWidgetSizeChanged() OVERRIDE;
36 41
37 private: 42 private:
38 scoped_ptr<TestCompositorDelegate> owned_delegate_; 43 scoped_ptr<TestCompositorDelegate> owned_delegate_;
39 44
40 DISALLOW_COPY_AND_ASSIGN(TestCompositor); 45 DISALLOW_COPY_AND_ASSIGN(TestCompositor);
41 }; 46 };
42 47
43 } // namespace ui 48 } // namespace ui
44 49
45 #endif // UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_ 50 #endif // UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698