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/headless/headless_window_manager.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 TestWindowManager::TestWindowManager(const base::FilePath& dump_location) | 12 HeadlessWindowManager::HeadlessWindowManager( |
13 : location_(dump_location) { | 13 const base::FilePath& dump_location) |
14 } | 14 : location_(dump_location) {} |
15 | 15 |
16 TestWindowManager::~TestWindowManager() { | 16 HeadlessWindowManager::~HeadlessWindowManager() { |
17 DCHECK(thread_checker_.CalledOnValidThread()); | 17 DCHECK(thread_checker_.CalledOnValidThread()); |
18 } | 18 } |
19 | 19 |
20 void TestWindowManager::Initialize() { | 20 void HeadlessWindowManager::Initialize() { |
21 if (location_.empty()) | 21 if (location_.empty()) |
22 return; | 22 return; |
23 if (!DirectoryExists(location_) && !base::CreateDirectory(location_) && | 23 if (!DirectoryExists(location_) && !base::CreateDirectory(location_) && |
24 location_ != base::FilePath("/dev/null")) | 24 location_ != base::FilePath("/dev/null")) |
25 PLOG(FATAL) << "unable to create output directory"; | 25 PLOG(FATAL) << "unable to create output directory"; |
26 if (!base::PathIsWritable(location_)) | 26 if (!base::PathIsWritable(location_)) |
27 PLOG(FATAL) << "unable to write to output location"; | 27 PLOG(FATAL) << "unable to write to output location"; |
28 } | 28 } |
29 | 29 |
30 int32_t TestWindowManager::AddWindow(TestWindow* window) { | 30 int32_t HeadlessWindowManager::AddWindow(HeadlessWindow* window) { |
31 return windows_.Add(window); | 31 return windows_.Add(window); |
32 } | 32 } |
33 | 33 |
34 void TestWindowManager::RemoveWindow(int32_t window_id, TestWindow* window) { | 34 void HeadlessWindowManager::RemoveWindow(int32_t window_id, |
| 35 HeadlessWindow* window) { |
35 DCHECK_EQ(window, windows_.Lookup(window_id)); | 36 DCHECK_EQ(window, windows_.Lookup(window_id)); |
36 windows_.Remove(window_id); | 37 windows_.Remove(window_id); |
37 } | 38 } |
38 | 39 |
39 TestWindow* TestWindowManager::GetWindow(int32_t window_id) { | 40 HeadlessWindow* HeadlessWindowManager::GetWindow(int32_t window_id) { |
40 return windows_.Lookup(window_id); | 41 return windows_.Lookup(window_id); |
41 } | 42 } |
42 | 43 |
43 base::FilePath TestWindowManager::base_path() const { | 44 base::FilePath HeadlessWindowManager::base_path() const { |
44 return location_; | 45 return location_; |
45 } | 46 } |
46 | 47 |
47 } // namespace ui | 48 } // namespace ui |
OLD | NEW |