| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "athena/home/athena_start_page_view.h" | 5 #include "athena/home/athena_start_page_view.h" |
| 6 | 6 |
| 7 #include "athena/home/home_card_constants.h" | 7 #include "athena/home/home_card_constants.h" |
| 8 #include "athena/test/base/athena_test_base.h" | 8 #include "athena/test/base/athena_test_base.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "ui/app_list/app_list_switches.h" | 12 #include "ui/app_list/app_list_switches.h" |
| 13 #include "ui/app_list/search_box_model.h" | 13 #include "ui/app_list/search_box_model.h" |
| 14 #include "ui/app_list/test/app_list_test_model.h" | 14 #include "ui/app_list/test/app_list_test_model.h" |
| 15 #include "ui/app_list/test/app_list_test_view_delegate.h" | 15 #include "ui/app_list/test/app_list_test_view_delegate.h" |
| 16 #include "ui/app_list/views/search_box_view.h" | 16 #include "ui/app_list/views/search_box_view.h" |
| 17 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
| 18 #include "ui/views/controls/textfield/textfield.h" | 18 #include "ui/views/controls/textfield/textfield.h" |
| 19 | 19 |
| 20 namespace athena { | 20 namespace athena { |
| 21 | 21 |
| 22 class AthenaTestViewDelegate : public app_list::test::AppListTestViewDelegate { | 22 class AthenaTestViewDelegate : public app_list::test::AppListTestViewDelegate { |
| 23 public: | 23 public: |
| 24 AthenaTestViewDelegate() {} | 24 AthenaTestViewDelegate() {} |
| 25 virtual ~AthenaTestViewDelegate() {} | 25 ~AthenaTestViewDelegate() override {} |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 // app_list::AppListViewDelegate: | 28 // app_list::AppListViewDelegate: |
| 29 virtual views::View* CreateStartPageWebView(const gfx::Size& size) override { | 29 views::View* CreateStartPageWebView(const gfx::Size& size) override { |
| 30 return new views::View(); | 30 return new views::View(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 DISALLOW_COPY_AND_ASSIGN(AthenaTestViewDelegate); | 33 DISALLOW_COPY_AND_ASSIGN(AthenaTestViewDelegate); |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 class AthenaStartPageViewTest : public test::AthenaTestBase { | 36 class AthenaStartPageViewTest : public test::AthenaTestBase { |
| 37 public: | 37 public: |
| 38 AthenaStartPageViewTest() {} | 38 AthenaStartPageViewTest() {} |
| 39 virtual ~AthenaStartPageViewTest() {} | 39 ~AthenaStartPageViewTest() override {} |
| 40 | 40 |
| 41 // testing::Test: | 41 // testing::Test: |
| 42 virtual void SetUp() override { | 42 void SetUp() override { |
| 43 test::AthenaTestBase::SetUp(); | 43 test::AthenaTestBase::SetUp(); |
| 44 for (size_t i = 0; i < GetMaxIconNum(); ++i) | 44 for (size_t i = 0; i < GetMaxIconNum(); ++i) |
| 45 AddTestItem(i); | 45 AddTestItem(i); |
| 46 | 46 |
| 47 view_.reset(new AthenaStartPageView(&view_delegate_)); | 47 view_.reset(new AthenaStartPageView(&view_delegate_)); |
| 48 SetSize(gfx::Size(1280, 800)); | 48 SetSize(gfx::Size(1280, 800)); |
| 49 } | 49 } |
| 50 virtual void TearDown() override { | 50 void TearDown() override { |
| 51 view_.reset(); | 51 view_.reset(); |
| 52 test::AthenaTestBase::TearDown(); | 52 test::AthenaTestBase::TearDown(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 void SetSize(const gfx::Size& new_size) { | 56 void SetSize(const gfx::Size& new_size) { |
| 57 view_->SetSize(new_size); | 57 view_->SetSize(new_size); |
| 58 view_->Layout(); | 58 view_->Layout(); |
| 59 } | 59 } |
| 60 | 60 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 EXPECT_EQ(icons_bounds.size().ToString(), GetIconsBounds().size().ToString()); | 270 EXPECT_EQ(icons_bounds.size().ToString(), GetIconsBounds().size().ToString()); |
| 271 | 271 |
| 272 // Adding more doesn't cause any effects. | 272 // Adding more doesn't cause any effects. |
| 273 AddTestItem(GetMaxIconNum() + 2); | 273 AddTestItem(GetMaxIconNum() + 2); |
| 274 EXPECT_EQ(GetMaxIconNum(), | 274 EXPECT_EQ(GetMaxIconNum(), |
| 275 static_cast<size_t>(GetIconsContainer()->child_count())); | 275 static_cast<size_t>(GetIconsContainer()->child_count())); |
| 276 EXPECT_EQ(icons_bounds.size().ToString(), GetIconsBounds().size().ToString()); | 276 EXPECT_EQ(icons_bounds.size().ToString(), GetIconsBounds().size().ToString()); |
| 277 } | 277 } |
| 278 | 278 |
| 279 } // namespace athena | 279 } // namespace athena |
| OLD | NEW |