| Index: ui/ozone/platform/test/test_window.cc
|
| diff --git a/ui/ozone/platform/test/test_window.cc b/ui/ozone/platform/test/test_window.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b6523cb85d601212efb29ef8b860a129ac802bb6
|
| --- /dev/null
|
| +++ b/ui/ozone/platform/test/test_window.cc
|
| @@ -0,0 +1,50 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// 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/test_window.h"
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/files/file_path.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| +#include "ui/ozone/platform/test/test_window_manager.h"
|
| +#include "ui/window/platform_window_delegate.h"
|
| +
|
| +namespace ui {
|
| +
|
| +TestWindow::TestWindow(PlatformWindowDelegate* delegate,
|
| + TestWindowManager* manager,
|
| + const gfx::Rect& bounds)
|
| + : delegate_(delegate), manager_(manager), bounds_(bounds) {
|
| + widget_ = manager_->AddWindow(this);
|
| +}
|
| +
|
| +TestWindow::~TestWindow() {
|
| + manager_->RemoveWindow(widget_, this);
|
| +}
|
| +
|
| +base::FilePath TestWindow::path() {
|
| + base::FilePath base_path = manager_->base_path();
|
| +
|
| + if (base_path == base::FilePath("/dev/null"))
|
| + return base_path;
|
| +
|
| + // Disambiguate multiple window output files with the window id.
|
| + return base_path.Append(base::IntToString(GetAcceleratedWidget()));
|
| +}
|
| +
|
| +gfx::Rect TestWindow::GetBounds() const {
|
| + return bounds_;
|
| +}
|
| +
|
| +gfx::AcceleratedWidget TestWindow::GetAcceleratedWidget() {
|
| + return widget_;
|
| +}
|
| +
|
| +void TestWindow::SetBounds(const gfx::Rect& bounds) {
|
| + bounds_ = bounds;
|
| + delegate_->OnBoundsChanged(bounds);
|
| +}
|
| +
|
| +} // namespace ui
|
|
|