OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ozone/platform/test/test_window_manager.h" | 5 #include "ui/ozone/platform/test/test_window_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 skia::RefPtr<SkSurface> surface_; | 62 skia::RefPtr<SkSurface> surface_; |
63 }; | 63 }; |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 TestWindowManager::TestWindowManager(const base::FilePath& dump_location) | 67 TestWindowManager::TestWindowManager(const base::FilePath& dump_location) |
68 : location_(dump_location) { | 68 : location_(dump_location) { |
69 } | 69 } |
70 | 70 |
71 TestWindowManager::~TestWindowManager() { | 71 TestWindowManager::~TestWindowManager() { |
| 72 DCHECK(thread_checker_.CalledOnValidThread()); |
72 } | 73 } |
73 | 74 |
74 void TestWindowManager::Initialize() { | 75 void TestWindowManager::Initialize() { |
75 if (location_.empty()) | 76 if (location_.empty()) |
76 return; | 77 return; |
77 if (!DirectoryExists(location_) && !base::CreateDirectory(location_) && | 78 if (!DirectoryExists(location_) && !base::CreateDirectory(location_) && |
78 location_ != base::FilePath("/dev/null")) | 79 location_ != base::FilePath("/dev/null")) |
79 PLOG(FATAL) << "unable to create output directory"; | 80 PLOG(FATAL) << "unable to create output directory"; |
80 if (!base::PathIsWritable(location_)) | 81 if (!base::PathIsWritable(location_)) |
81 PLOG(FATAL) << "unable to write to output location"; | 82 PLOG(FATAL) << "unable to write to output location"; |
82 } | 83 } |
83 | 84 |
84 int32_t TestWindowManager::AddWindow(TestWindow* window) { | 85 int32_t TestWindowManager::AddWindow(TestWindow* window) { |
85 return windows_.Add(window); | 86 return windows_.Add(window); |
86 } | 87 } |
87 | 88 |
88 void TestWindowManager::RemoveWindow(int32_t window_id, TestWindow* window) { | 89 void TestWindowManager::RemoveWindow(int32_t window_id, TestWindow* window) { |
89 DCHECK_EQ(window, windows_.Lookup(window_id)); | 90 DCHECK_EQ(window, windows_.Lookup(window_id)); |
90 windows_.Remove(window_id); | 91 windows_.Remove(window_id); |
91 } | 92 } |
92 | 93 |
93 base::FilePath TestWindowManager::base_path() const { | 94 base::FilePath TestWindowManager::base_path() const { |
94 return location_; | 95 return location_; |
95 } | 96 } |
96 | 97 |
97 scoped_ptr<SurfaceOzoneCanvas> TestWindowManager::CreateCanvasForWidget( | 98 scoped_ptr<SurfaceOzoneCanvas> TestWindowManager::CreateCanvasForWidget( |
98 gfx::AcceleratedWidget widget) { | 99 gfx::AcceleratedWidget widget) { |
| 100 DCHECK(thread_checker_.CalledOnValidThread()); |
99 TestWindow* window = windows_.Lookup(widget); | 101 TestWindow* window = windows_.Lookup(widget); |
100 DCHECK(window); | 102 DCHECK(window); |
101 return make_scoped_ptr<SurfaceOzoneCanvas>(new FileSurface(window->path())); | 103 return make_scoped_ptr<SurfaceOzoneCanvas>(new FileSurface(window->path())); |
102 } | 104 } |
103 | 105 |
104 bool TestWindowManager::LoadEGLGLES2Bindings( | 106 bool TestWindowManager::LoadEGLGLES2Bindings( |
105 AddGLLibraryCallback add_gl_library, | 107 AddGLLibraryCallback add_gl_library, |
106 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { | 108 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { |
| 109 DCHECK(thread_checker_.CalledOnValidThread()); |
107 return false; | 110 return false; |
108 } | 111 } |
109 | 112 |
110 } // namespace ui | 113 } // namespace ui |
OLD | NEW |