Revert of Roll src/third_party/WebKit e0eac24:489c548 (svn 193311:193320) (patchset...
[chromium-blink-merge.git] / ui / ozone / platform / test / test_window.cc
blob2890ccf31d77f9baa4c826bf916abf35d172919c
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.h"
7 #include <string>
9 #include "base/files/file_path.h"
10 #include "base/strings/string_number_conversions.h"
11 #include "ui/events/platform/platform_event_source.h"
12 #include "ui/ozone/platform/test/test_window_manager.h"
13 #include "ui/platform_window/platform_window_delegate.h"
15 namespace ui {
17 TestWindow::TestWindow(PlatformWindowDelegate* delegate,
18 TestWindowManager* manager,
19 const gfx::Rect& bounds)
20 : delegate_(delegate), manager_(manager), bounds_(bounds) {
21 widget_ = manager_->AddWindow(this);
22 delegate_->OnAcceleratedWidgetAvailable(widget_);
25 TestWindow::~TestWindow() {
26 manager_->RemoveWindow(widget_, this);
29 base::FilePath TestWindow::path() {
30 base::FilePath base_path = manager_->base_path();
31 if (base_path.empty() || base_path == base::FilePath("/dev/null"))
32 return base_path;
34 // Disambiguate multiple window output files with the window id.
35 return base_path.Append(base::IntToString(widget_));
38 gfx::Rect TestWindow::GetBounds() {
39 return bounds_;
42 void TestWindow::SetBounds(const gfx::Rect& bounds) {
43 bounds_ = bounds;
44 delegate_->OnBoundsChanged(bounds);
47 void TestWindow::Show() {
50 void TestWindow::Hide() {
53 void TestWindow::Close() {
56 void TestWindow::SetCapture() {
59 void TestWindow::ReleaseCapture() {
62 void TestWindow::ToggleFullscreen() {
65 void TestWindow::Maximize() {
68 void TestWindow::Minimize() {
71 void TestWindow::Restore() {
74 void TestWindow::SetCursor(PlatformCursor cursor) {
77 void TestWindow::MoveCursorTo(const gfx::Point& location) {
80 void TestWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {
83 } // namespace ui