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