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 #ifndef UI_OZONE_PLATFORM_TEST_FILE_SURFACE_FACTORY_H_ | 5 #ifndef UI_OZONE_PLATFORM_TEST_FILE_SURFACE_FACTORY_H_ |
6 #define UI_OZONE_PLATFORM_TEST_FILE_SURFACE_FACTORY_H_ | 6 #define UI_OZONE_PLATFORM_TEST_FILE_SURFACE_FACTORY_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/id_map.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 12 #include "ui/ozone/platform/test/test_window.h" |
11 #include "ui/ozone/public/surface_factory_ozone.h" | 13 #include "ui/ozone/public/surface_factory_ozone.h" |
12 | 14 |
13 namespace ui { | 15 namespace ui { |
14 | 16 |
15 class OZONE_BASE_EXPORT FileSurfaceFactory : public SurfaceFactoryOzone { | 17 class TestWindowManager : public SurfaceFactoryOzone { |
16 public: | 18 public: |
17 explicit FileSurfaceFactory(const base::FilePath& dump_location); | 19 explicit TestWindowManager(const base::FilePath& dump_location); |
18 virtual ~FileSurfaceFactory(); | 20 virtual ~TestWindowManager(); |
19 | 21 |
20 private: | 22 // Initialize (mainly check that we have a place to write output to). |
| 23 void Initialize(); |
| 24 |
| 25 // Register a new window. Returns the window id. |
| 26 int32_t AddWindow(TestWindow* window); |
| 27 |
| 28 // Remove a window. |
| 29 void RemoveWindow(int32_t window_id, TestWindow* window); |
| 30 |
| 31 // User-supplied path for images. |
| 32 base::FilePath base_path() const; |
| 33 |
21 // SurfaceFactoryOzone: | 34 // SurfaceFactoryOzone: |
22 virtual HardwareState InitializeHardware() OVERRIDE; | 35 virtual HardwareState InitializeHardware() OVERRIDE; |
23 virtual void ShutdownHardware() OVERRIDE; | 36 virtual void ShutdownHardware() OVERRIDE; |
24 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 37 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
25 virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( | 38 virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( |
26 gfx::AcceleratedWidget w) OVERRIDE; | 39 gfx::AcceleratedWidget w) OVERRIDE; |
27 virtual bool LoadEGLGLES2Bindings( | 40 virtual bool LoadEGLGLES2Bindings( |
28 AddGLLibraryCallback add_gl_library, | 41 AddGLLibraryCallback add_gl_library, |
29 SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE; | 42 SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE; |
30 | 43 |
| 44 private: |
31 base::FilePath location_; | 45 base::FilePath location_; |
32 | 46 |
33 DISALLOW_COPY_AND_ASSIGN(FileSurfaceFactory); | 47 IDMap<TestWindow> windows_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(TestWindowManager); |
34 }; | 50 }; |
35 | 51 |
36 } // namespace ui | 52 } // namespace ui |
37 | 53 |
38 #endif // UI_OZONE_PLATFORM_TEST_FILE_SURFACE_FACTORY_H_ | 54 #endif // UI_OZONE_PLATFORM_TEST_FILE_SURFACE_FACTORY_H_ |
OLD | NEW |