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.
5 #include "ui/ozone/platform/test/test_window_manager.h"
7 #include "base/files/file_util.h"
8 #include "base/location.h"
12 TestWindowManager::TestWindowManager(const base::FilePath
& dump_location
)
13 : location_(dump_location
) {
16 TestWindowManager::~TestWindowManager() {
17 DCHECK(thread_checker_
.CalledOnValidThread());
20 void TestWindowManager::Initialize() {
21 if (location_
.empty())
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";
30 int32_t TestWindowManager::AddWindow(TestWindow
* window
) {
31 return windows_
.Add(window
);
34 void TestWindowManager::RemoveWindow(int32_t window_id
, TestWindow
* window
) {
35 DCHECK_EQ(window
, windows_
.Lookup(window_id
));
36 windows_
.Remove(window_id
);
39 TestWindow
* TestWindowManager::GetWindow(int32_t window_id
) {
40 return windows_
.Lookup(window_id
);
43 base::FilePath
TestWindowManager::base_path() const {