Chromium Code Reviews| Index: ui/app_list/views/app_list_view_unittest.cc |
| diff --git a/ui/app_list/views/app_list_view_unittest.cc b/ui/app_list/views/app_list_view_unittest.cc |
| index 1238e254db873e01aa40d8ebb7bfb9cc2fa5e718..7fa54a84c4ada15f9eed801b6a71c2962f0d20fa 100644 |
| --- a/ui/app_list/views/app_list_view_unittest.cc |
| +++ b/ui/app_list/views/app_list_view_unittest.cc |
| @@ -43,10 +43,6 @@ enum TestType { |
| TEST_TYPE_END, |
| }; |
| -bool IsViewAtOrigin(views::View* view) { |
| - return view->bounds().origin().IsOrigin(); |
| -} |
| - |
| size_t GetVisibleTileItemViews(const std::vector<TileItemView*>& tiles) { |
| size_t count = 0; |
| for (std::vector<TileItemView*>::const_iterator it = tiles.begin(); |
| @@ -206,7 +202,9 @@ void AppListViewTestContext::ShowContentsViewPageAndVerify(int index) { |
| contents_view->SetActivePage(index); |
| contents_view->Layout(); |
| for (int i = 0; i < contents_view->NumLauncherPages(); ++i) { |
| - EXPECT_EQ(i == index, IsViewAtOrigin(contents_view->GetPageView(i))); |
| + EXPECT_EQ(i == index, |
| + contents_view->GetDefaultContentsBounds() == |
| + contents_view->GetPageView(i)->bounds()); |
| } |
| } |
| @@ -384,28 +382,31 @@ void AppListViewTestContext::RunPageSwitchingAnimationTest() { |
| contents_view->SetActivePage(0); |
| contents_view->Layout(); |
| - EXPECT_TRUE(IsViewAtOrigin(contents_view->GetPageView(0))); |
| - EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(1))); |
| - EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(2))); |
| + |
| + const gfx::Rect expected_bounds = contents_view->GetDefaultContentsBounds(); |
| + |
| + EXPECT_EQ(expected_bounds, contents_view->GetPageView(0)->bounds()); |
| + EXPECT_NE(expected_bounds, contents_view->GetPageView(1)->bounds()); |
| + EXPECT_NE(expected_bounds, contents_view->GetPageView(2)->bounds()); |
| // Change pages. View should not have moved without Layout(). |
| contents_view->SetActivePage(1); |
| - EXPECT_TRUE(IsViewAtOrigin(contents_view->GetPageView(0))); |
| - EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(1))); |
| - EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(2))); |
| + EXPECT_EQ(expected_bounds, contents_view->GetPageView(0)->bounds()); |
| + EXPECT_NE(expected_bounds, contents_view->GetPageView(1)->bounds()); |
| + EXPECT_NE(expected_bounds, contents_view->GetPageView(2)->bounds()); |
| // Change to a third page. This queues up the second animation behind the |
| // first. |
| contents_view->SetActivePage(2); |
| - EXPECT_TRUE(IsViewAtOrigin(contents_view->GetPageView(0))); |
| - EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(1))); |
| - EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(2))); |
| + EXPECT_EQ(expected_bounds, contents_view->GetPageView(0)->bounds()); |
| + EXPECT_NE(expected_bounds, contents_view->GetPageView(1)->bounds()); |
| + EXPECT_NE(expected_bounds, contents_view->GetPageView(2)->bounds()); |
| // Call Layout(). Should jump to the third page. |
| contents_view->Layout(); |
| - EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(0))); |
| - EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(1))); |
| - EXPECT_TRUE(IsViewAtOrigin(contents_view->GetPageView(2))); |
| + EXPECT_NE(expected_bounds, contents_view->GetPageView(0)->bounds()); |
| + EXPECT_NE(expected_bounds, contents_view->GetPageView(1)->bounds()); |
| + EXPECT_EQ(expected_bounds, contents_view->GetPageView(2)->bounds()); |
| } |
| Close(); |
| @@ -485,14 +486,18 @@ void AppListViewTestContext::RunSearchResultsTest() { |
| EXPECT_TRUE(contents_view->IsShowingSearchResults()); |
| EXPECT_TRUE(main_view->search_box_view()->visible()); |
| + const gfx::Rect active_contents_bounds = |
|
Matt Giuca
2014/10/24 03:21:40
Why not "default_contents_bounds"?
calamity
2014/10/24 06:13:07
Done.
|
| + contents_view->GetDefaultContentsBounds(); |
| if (test_type_ == EXPERIMENTAL) { |
| EXPECT_TRUE( |
| contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_START)); |
| - EXPECT_TRUE(IsViewAtOrigin(contents_view->start_page_view())); |
| + EXPECT_EQ(active_contents_bounds, |
| + contents_view->start_page_view()->bounds()); |
| } else { |
| EXPECT_TRUE(contents_view->IsNamedPageActive( |
| ContentsView::NAMED_PAGE_SEARCH_RESULTS)); |
| - EXPECT_TRUE(IsViewAtOrigin(contents_view->search_results_view())); |
| + EXPECT_EQ(active_contents_bounds, |
| + contents_view->search_results_view()->bounds()); |
| } |
| // Hide the search results. |
| @@ -502,7 +507,8 @@ void AppListViewTestContext::RunSearchResultsTest() { |
| // Check that we return to the page that we were on before the search. |
| EXPECT_TRUE(contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_APPS)); |
| - EXPECT_TRUE(IsViewAtOrigin(contents_view->apps_container_view())); |
| + EXPECT_EQ(active_contents_bounds, |
| + contents_view->apps_container_view()->bounds()); |
| EXPECT_TRUE(main_view->search_box_view()->visible()); |
| if (test_type_ == EXPERIMENTAL) { |
| @@ -524,12 +530,14 @@ void AppListViewTestContext::RunSearchResultsTest() { |
| EXPECT_EQ(search_text, main_view->search_box_view()->search_box()->text()); |
| EXPECT_TRUE( |
| contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_START)); |
| - EXPECT_TRUE(IsViewAtOrigin(contents_view->start_page_view())); |
| + EXPECT_EQ(active_contents_bounds, |
| + contents_view->start_page_view()->bounds()); |
| // Check that typing into the real search box triggers the search page. |
| ShowContentsViewPageAndVerify( |
| contents_view->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS)); |
| - EXPECT_TRUE(IsViewAtOrigin(contents_view->apps_container_view())); |
| + EXPECT_EQ(active_contents_bounds, |
| + contents_view->apps_container_view()->bounds()); |
| base::string16 new_search_text = base::UTF8ToUTF16("apple"); |
| main_view->search_box_view()->search_box()->SetText(base::string16()); |