Chromium Code Reviews| Index: ui/ozone/platform/test/test_window_manager.cc |
| diff --git a/ui/ozone/platform/test/file_surface_factory.cc b/ui/ozone/platform/test/test_window_manager.cc |
| similarity index 64% |
| rename from ui/ozone/platform/test/file_surface_factory.cc |
| rename to ui/ozone/platform/test/test_window_manager.cc |
| index ab1e67cbaad31323009c504365845ebbb98d86c0..6cbefc2b4f6464308ad4dab881d42330a42fd69c 100644 |
| --- a/ui/ozone/platform/test/file_surface_factory.cc |
| +++ b/ui/ozone/platform/test/test_window_manager.cc |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "ui/ozone/platform/test/file_surface_factory.h" |
| +#include "ui/ozone/platform/test/test_window_manager.h" |
| #include "base/bind.h" |
| #include "base/file_util.h" |
| @@ -63,33 +63,50 @@ class FileSurface : public SurfaceOzoneCanvas { |
| } // namespace |
| -FileSurfaceFactory::FileSurfaceFactory(const base::FilePath& dump_location) |
| +TestWindowManager::TestWindowManager(const base::FilePath& dump_location) |
| : location_(dump_location) { |
| - CHECK(!base::DirectoryExists(location_)) << "Location cannot be a directory (" |
| - << location_.value() << ")"; |
| - CHECK(!base::PathExists(location_) || base::PathIsWritable(location_)); |
| + if (!DirectoryExists(location_) && !base::CreateDirectory(location_) && |
|
alexst (slow to review)
2014/07/17 15:28:30
Can you move this into a separate function? Maybe
spang
2014/07/17 19:51:44
Done.
|
| + dump_location != base::FilePath("/dev/null")) |
| + PLOG(FATAL) << "unable to create output directory"; |
| + if (!base::PathIsWritable(location_)) |
| + PLOG(FATAL) << "unable to write to output location"; |
| } |
| -FileSurfaceFactory::~FileSurfaceFactory() { |
| +TestWindowManager::~TestWindowManager() { |
| } |
| -SurfaceFactoryOzone::HardwareState FileSurfaceFactory::InitializeHardware() { |
| +int32_t TestWindowManager::AddWindow(TestWindow* window) { |
| + return windows_.Add(window); |
| +} |
| + |
| +void TestWindowManager::RemoveWindow(int32_t window_id, TestWindow* window) { |
| + DCHECK_EQ(window, windows_.Lookup(window_id)); |
| + windows_.Remove(window_id); |
| +} |
| + |
| +base::FilePath TestWindowManager::base_path() const { |
| + return location_; |
| +} |
| + |
| +SurfaceFactoryOzone::HardwareState TestWindowManager::InitializeHardware() { |
| return INITIALIZED; |
| } |
| -void FileSurfaceFactory::ShutdownHardware() { |
| +void TestWindowManager::ShutdownHardware() { |
| } |
| -gfx::AcceleratedWidget FileSurfaceFactory::GetAcceleratedWidget() { |
| - return 1; |
| +gfx::AcceleratedWidget TestWindowManager::GetAcceleratedWidget() { |
| + NOTREACHED(); |
| + return -1; |
| } |
| -scoped_ptr<SurfaceOzoneCanvas> FileSurfaceFactory::CreateCanvasForWidget( |
| - gfx::AcceleratedWidget w) { |
| - return make_scoped_ptr<SurfaceOzoneCanvas>(new FileSurface(location_)); |
| +scoped_ptr<SurfaceOzoneCanvas> TestWindowManager::CreateCanvasForWidget( |
| + gfx::AcceleratedWidget widget) { |
| + TestWindow* window = windows_.Lookup(widget); |
|
alexst (slow to review)
2014/07/17 15:28:30
Please DCHECK that this is sane.
spang
2014/07/17 19:51:44
Done.
|
| + return make_scoped_ptr<SurfaceOzoneCanvas>(new FileSurface(window->path())); |
| } |
| -bool FileSurfaceFactory::LoadEGLGLES2Bindings( |
| +bool TestWindowManager::LoadEGLGLES2Bindings( |
| AddGLLibraryCallback add_gl_library, |
| SetGLGetProcAddressProcCallback set_gl_get_proc_address) { |
| return false; |