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

Unified Diff: ui/views/test/test_layout_manager.h

Issue 2439093002: Reland of "Added common layout framework for system menu rows." (Closed)
Patch Set: Addressed review comments. Created 4 years, 2 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
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/test/test_layout_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/test/test_layout_manager.h
diff --git a/ui/views/test/test_layout_manager.h b/ui/views/test/test_layout_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..b50f01902b765dea8429677db9bf859dca759e2e
--- /dev/null
+++ b/ui/views/test/test_layout_manager.h
@@ -0,0 +1,45 @@
+// Copyright 2016 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.
+
+#ifndef UI_VIEWS_TEST_TEST_LAYOUT_MANAGER_H_
+#define UI_VIEWS_TEST_TEST_LAYOUT_MANAGER_H_
+
+#include "ui/gfx/geometry/size.h"
+#include "ui/views/layout/layout_manager.h"
+
+namespace views {
+namespace test {
+
+// A stub layout manager that returns a specific preferred size and height for
+// width.
+class TestLayoutManager : public LayoutManager {
+ public:
+ TestLayoutManager();
+ ~TestLayoutManager() override;
+
+ void set_preferred_size(const gfx::Size& size) { preferred_size_ = size; }
+
+ void set_preferred_height_for_width(int height) {
+ preferred_height_for_width_ = height;
+ }
+
+ // LayoutManager:
+ void Layout(View* host) override;
+ gfx::Size GetPreferredSize(const View* host) const override;
+ int GetPreferredHeightForWidth(const View* host, int width) const override;
+
+ private:
+ // The return value of GetPreferredSize();
+ gfx::Size preferred_size_;
+
+ // The return value for GetPreferredHeightForWidth().
+ int preferred_height_for_width_ = 0;
+
+ DISALLOW_COPY_AND_ASSIGN(TestLayoutManager);
+};
+
+} // namespace test
+} // namespace views
+
+#endif // UI_VIEWS_TEST_TEST_LAYOUT_MANAGER_H_
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/test/test_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698