Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Unified Diff: ui/ozone/platform/test/test_window.cc

Issue 377973005: ozone: test: Convert to PlatformWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698