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

Unified Diff: ash/common/system/tray/size_range_layout_unittest.cc

Issue 2732813002: chromeos: Move files in //ash/common to //ash, part 1 (Closed)
Patch Set: rebase Created 3 years, 10 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 | « ash/common/system/tray/size_range_layout.cc ('k') | ash/common/system/tray/special_popup_row.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/tray/size_range_layout_unittest.cc
diff --git a/ash/common/system/tray/size_range_layout_unittest.cc b/ash/common/system/tray/size_range_layout_unittest.cc
deleted file mode 100644
index b04ce5826d2915ed6521c49439b51e146650139b..0000000000000000000000000000000000000000
--- a/ash/common/system/tray/size_range_layout_unittest.cc
+++ /dev/null
@@ -1,189 +0,0 @@
-// 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.
-
-#include "ash/common/system/tray/size_range_layout.h"
-#include "base/memory/ptr_util.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/views/test/test_layout_manager.h"
-#include "ui/views/view.h"
-
-namespace ash {
-
-class SizeRangeLayoutTest : public testing::Test {
- public:
- SizeRangeLayoutTest();
-
- // Wrapper function to access the minimum preferred size of |layout|.
- gfx::Size GetMinSize(const SizeRangeLayout* layout) const;
-
- // Wrapper function to access the maximum preferred size of |layout|.
- gfx::Size GetMaxSize(const SizeRangeLayout* layout) const;
-
- protected:
- views::View host_;
-
- const gfx::Size kAbsoluteMinSize;
- const gfx::Size kAbsoluteMaxSize;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(SizeRangeLayoutTest);
-};
-
-SizeRangeLayoutTest::SizeRangeLayoutTest()
- : kAbsoluteMinSize(SizeRangeLayout::kAbsoluteMinSize,
- SizeRangeLayout::kAbsoluteMinSize),
- kAbsoluteMaxSize(SizeRangeLayout::kAbsoluteMaxSize,
- SizeRangeLayout::kAbsoluteMaxSize) {}
-
-gfx::Size SizeRangeLayoutTest::GetMinSize(const SizeRangeLayout* layout) const {
- return layout->min_size_;
-}
-
-gfx::Size SizeRangeLayoutTest::GetMaxSize(const SizeRangeLayout* layout) const {
- return layout->max_size_;
-}
-
-TEST_F(SizeRangeLayoutTest, SizeRangeForDefaultConstruction) {
- SizeRangeLayout layout;
- EXPECT_EQ(kAbsoluteMinSize, GetMinSize(&layout));
- EXPECT_EQ(kAbsoluteMaxSize, GetMaxSize(&layout));
-}
-
-TEST_F(SizeRangeLayoutTest, SizeRangeForExplicitConstruction) {
- const gfx::Size kSmallSize = gfx::Size(13, 14);
- const gfx::Size kLargeSize = gfx::Size(25, 26);
-
- SizeRangeLayout layout(kSmallSize, kLargeSize);
- EXPECT_EQ(kSmallSize, GetMinSize(&layout));
- EXPECT_EQ(kLargeSize, GetMaxSize(&layout));
-}
-
-TEST_F(SizeRangeLayoutTest, InvalidMinSizeForExplicitConstruction) {
- const gfx::Size kInvalidSmallSize(-1, 2);
- const gfx::Size kExpectedMinSize(0, 2);
-
- SizeRangeLayout layout(kInvalidSmallSize, kAbsoluteMaxSize);
- EXPECT_EQ(kExpectedMinSize, GetMinSize(&layout));
-}
-
-TEST_F(SizeRangeLayoutTest, InvalidMaxSizeForExplicitConstruction) {
- const gfx::Size kInvalidSmallSize(-1, 2);
- const gfx::Size kExpectedMinSize(0, 2);
-
- SizeRangeLayout layout(kInvalidSmallSize, kAbsoluteMaxSize);
- EXPECT_EQ(kExpectedMinSize, GetMinSize(&layout));
-}
-
-TEST_F(SizeRangeLayoutTest, MaxSizeSmallerThanMinSizeConstruction) {
- const gfx::Size kMinSize(10, 11);
- const gfx::Size kMaxSize(5, 6);
-
- SizeRangeLayout layout(kMinSize, kMaxSize);
- EXPECT_EQ(kMaxSize, GetMinSize(&layout));
- EXPECT_EQ(kMaxSize, GetMaxSize(&layout));
-}
-
-TEST_F(SizeRangeLayoutTest, SizeRangeForExplicitSetSize) {
- const gfx::Size kSize = gfx::Size(13, 14);
-
- SizeRangeLayout layout;
- EXPECT_NE(kSize, GetMinSize(&layout));
- EXPECT_NE(kSize, GetMaxSize(&layout));
-
- layout.SetSize(kSize);
- EXPECT_EQ(kSize, GetMinSize(&layout));
- EXPECT_EQ(kSize, GetMaxSize(&layout));
-}
-
-TEST_F(SizeRangeLayoutTest, InvalidSizeRangesForExplicitSetSize) {
- const gfx::Size kInvalidSize(-7, 8);
- const gfx::Size kExpectedSize(0, 8);
-
- SizeRangeLayout layout;
- layout.SetSize(kInvalidSize);
- EXPECT_EQ(kExpectedSize, GetMinSize(&layout));
- EXPECT_EQ(kExpectedSize, GetMaxSize(&layout));
-}
-
-TEST_F(SizeRangeLayoutTest, InternalLayoutManagerPreferredSizeIsUsed) {
- const gfx::Size kSize(7, 8);
- std::unique_ptr<views::test::TestLayoutManager> child_layout =
- base::MakeUnique<views::test::TestLayoutManager>();
- child_layout->set_preferred_size(kSize);
-
- SizeRangeLayout layout;
- EXPECT_NE(kSize, layout.GetPreferredSize(&host_));
-
- layout.SetLayoutManager(std::move(child_layout));
- EXPECT_EQ(kSize, layout.GetPreferredSize(&host_));
-}
-
-TEST_F(SizeRangeLayoutTest, SmallPreferredSizeIsClamped) {
- const gfx::Size kMinSize(10, 10);
- const gfx::Size kMaxSize(20, 20);
- const gfx::Size kLayoutPreferredSize(5, 5);
- std::unique_ptr<views::test::TestLayoutManager> child_layout =
- base::MakeUnique<views::test::TestLayoutManager>();
- child_layout->set_preferred_size(kLayoutPreferredSize);
-
- SizeRangeLayout layout;
- layout.SetLayoutManager(std::move(child_layout));
- layout.SetMinSize(kMinSize);
- layout.SetMaxSize(kMaxSize);
- EXPECT_EQ(kMinSize, layout.GetPreferredSize(&host_));
-}
-
-TEST_F(SizeRangeLayoutTest, LargePreferredSizeIsClamped) {
- const gfx::Size kMinSize(10, 10);
- const gfx::Size kMaxSize(20, 20);
- const gfx::Size kLayoutPreferredSize(25, 25);
- std::unique_ptr<views::test::TestLayoutManager> child_layout =
- base::MakeUnique<views::test::TestLayoutManager>();
- child_layout->set_preferred_size(kLayoutPreferredSize);
-
- SizeRangeLayout layout;
- layout.SetLayoutManager(std::move(child_layout));
- layout.SetMinSize(kMinSize);
- layout.SetMaxSize(kMaxSize);
- EXPECT_EQ(kMaxSize, layout.GetPreferredSize(&host_));
-}
-
-TEST_F(SizeRangeLayoutTest, MaxSizeLargerThanMinSizeUpdatesMinSize) {
- const gfx::Size kMinSize(10, 10);
- const gfx::Size kMaxSize(5, 5);
-
- SizeRangeLayout layout;
- layout.SetMinSize(kMinSize);
- EXPECT_EQ(kMinSize, GetMinSize(&layout));
- layout.SetMaxSize(kMaxSize);
- EXPECT_EQ(kMaxSize, GetMinSize(&layout));
-}
-
-TEST_F(SizeRangeLayoutTest, MinSizeSmallerThanMaxSizeUpdatesMaxSize) {
- const gfx::Size kMinSize(10, 10);
- const gfx::Size kMaxSize(5, 5);
-
- SizeRangeLayout layout;
- layout.SetMaxSize(kMaxSize);
- EXPECT_EQ(kMaxSize, GetMaxSize(&layout));
- layout.SetMinSize(kMinSize);
- EXPECT_EQ(kMinSize, GetMaxSize(&layout));
-}
-
-TEST_F(SizeRangeLayoutTest,
- InternalLayoutManagerPreferredHeightForWidthIsUsed) {
- const int kWidth = 5;
- const int kHeight = 9;
- std::unique_ptr<views::test::TestLayoutManager> child_layout =
- base::MakeUnique<views::test::TestLayoutManager>();
- child_layout->set_preferred_height_for_width(kHeight);
-
- SizeRangeLayout layout;
- EXPECT_NE(kHeight, layout.GetPreferredHeightForWidth(&host_, kWidth));
-
- layout.SetLayoutManager(std::move(child_layout));
- EXPECT_EQ(kHeight, layout.GetPreferredHeightForWidth(&host_, kWidth));
-}
-
-} // namespace ash
« no previous file with comments | « ash/common/system/tray/size_range_layout.cc ('k') | ash/common/system/tray/special_popup_row.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698