| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/app_list/pagination_model.h" | 5 #include "ui/app_list/pagination_model.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 int transition_page_; | 105 int transition_page_; |
| 106 | 106 |
| 107 std::string selected_pages_; | 107 std::string selected_pages_; |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(TestPaginationModelObserver); | 109 DISALLOW_COPY_AND_ASSIGN(TestPaginationModelObserver); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 class PaginationModelTest : public testing::Test { | 112 class PaginationModelTest : public testing::Test { |
| 113 public: | 113 public: |
| 114 PaginationModelTest() {} | 114 PaginationModelTest() {} |
| 115 virtual ~PaginationModelTest() {} | 115 ~PaginationModelTest() override {} |
| 116 | 116 |
| 117 // testing::Test overrides: | 117 // testing::Test overrides: |
| 118 virtual void SetUp() override { | 118 void SetUp() override { |
| 119 pagination_.SetTotalPages(5); | 119 pagination_.SetTotalPages(5); |
| 120 pagination_.SetTransitionDurations(1, 1); | 120 pagination_.SetTransitionDurations(1, 1); |
| 121 observer_.set_model(&pagination_); | 121 observer_.set_model(&pagination_); |
| 122 pagination_.AddObserver(&observer_); | 122 pagination_.AddObserver(&observer_); |
| 123 } | 123 } |
| 124 virtual void TearDown() override { | 124 void TearDown() override { |
| 125 pagination_.RemoveObserver(&observer_); | 125 pagination_.RemoveObserver(&observer_); |
| 126 observer_.set_model(NULL); | 126 observer_.set_model(NULL); |
| 127 } | 127 } |
| 128 | 128 |
| 129 protected: | 129 protected: |
| 130 void SetStartPageAndExpects(int start_page, | 130 void SetStartPageAndExpects(int start_page, |
| 131 int expected_selection, | 131 int expected_selection, |
| 132 int expected_transition_start, | 132 int expected_transition_start, |
| 133 int expected_transition_end) { | 133 int expected_transition_end) { |
| 134 observer_.set_expected_page_selection(0); | 134 observer_.set_expected_page_selection(0); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 EXPECT_EQ(1, pagination_.selected_page()); | 423 EXPECT_EQ(1, pagination_.selected_page()); |
| 424 | 424 |
| 425 // But if the currently selected_page exceeds the total number of pages, | 425 // But if the currently selected_page exceeds the total number of pages, |
| 426 // it automatically switches to the last page. | 426 // it automatically switches to the last page. |
| 427 pagination_.SetTotalPages(1); | 427 pagination_.SetTotalPages(1); |
| 428 EXPECT_EQ(0, pagination_.selected_page()); | 428 EXPECT_EQ(0, pagination_.selected_page()); |
| 429 } | 429 } |
| 430 | 430 |
| 431 } // namespace test | 431 } // namespace test |
| 432 } // namespace app_list | 432 } // namespace app_list |
| OLD | NEW |