| 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 f20c833d45c9d81f2d25f4a5c9e1e3186b5dda24..20742fca7fe9bfa28ea6872b051fb5ce7cd0964e 100644
|
| --- a/ui/app_list/views/app_list_view_unittest.cc
|
| +++ b/ui/app_list/views/app_list_view_unittest.cc
|
| @@ -142,6 +142,10 @@ class AppListViewTestContext {
|
| // Closes the app list. This sets |view_| to NULL.
|
| void Close();
|
|
|
| + // Checks the search box widget is at |expected| in the contents view's
|
| + // coordinate space.
|
| + bool CheckSearchBoxWidget(const gfx::Rect& expected);
|
| +
|
| // Gets the PaginationModel owned by |view_|.
|
| PaginationModel* GetPaginationModel();
|
|
|
| @@ -259,6 +263,15 @@ void AppListViewTestContext::Close() {
|
| EXPECT_FALSE(view_);
|
| }
|
|
|
| +bool AppListViewTestContext::CheckSearchBoxWidget(const gfx::Rect& expected) {
|
| + ContentsView* contents_view = view_->app_list_main_view()->contents_view();
|
| + gfx::Point point = expected.origin();
|
| + views::View::ConvertPointToScreen(contents_view, &point);
|
| +
|
| + return gfx::Rect(point, expected.size()) ==
|
| + view_->search_box_widget()->GetWindowBoundsInScreen();
|
| +}
|
| +
|
| PaginationModel* AppListViewTestContext::GetPaginationModel() {
|
| return view_->GetAppsPaginationModel();
|
| }
|
| @@ -598,8 +611,8 @@ void AppListViewTestContext::RunSearchResultsTest() {
|
| EXPECT_EQ(default_contents_bounds,
|
| contents_view->start_page_view()->bounds());
|
| // TODO(mgiuca): The search box should be small and centered.
|
| - EXPECT_EQ(contents_view->GetDefaultSearchBoxBounds(),
|
| - view_->search_box_view()->bounds());
|
| + EXPECT_TRUE(
|
| + CheckSearchBoxWidget(contents_view->GetDefaultSearchBoxBounds()));
|
|
|
| base::string16 search_text = base::UTF8ToUTF16("test");
|
| main_view->search_box_view()->search_box()->SetText(base::string16());
|
| @@ -610,16 +623,16 @@ void AppListViewTestContext::RunSearchResultsTest() {
|
| view_->Layout();
|
| EXPECT_TRUE(
|
| contents_view->IsStateActive(AppListModel::STATE_SEARCH_RESULTS));
|
| - EXPECT_EQ(contents_view->GetDefaultSearchBoxBounds(),
|
| - view_->search_box_view()->bounds());
|
| + EXPECT_TRUE(
|
| + CheckSearchBoxWidget(contents_view->GetDefaultSearchBoxBounds()));
|
|
|
| // Check that typing into the search box triggers the search page.
|
| EXPECT_TRUE(SetAppListState(AppListModel::STATE_APPS));
|
| view_->Layout();
|
| EXPECT_EQ(default_contents_bounds,
|
| contents_view->apps_container_view()->bounds());
|
| - EXPECT_EQ(contents_view->GetDefaultSearchBoxBounds(),
|
| - view_->search_box_view()->bounds());
|
| + EXPECT_TRUE(
|
| + CheckSearchBoxWidget(contents_view->GetDefaultSearchBoxBounds()));
|
|
|
| base::string16 new_search_text = base::UTF8ToUTF16("apple");
|
| main_view->search_box_view()->search_box()->SetText(base::string16());
|
| @@ -631,8 +644,8 @@ void AppListViewTestContext::RunSearchResultsTest() {
|
| view_->Layout();
|
| EXPECT_TRUE(
|
| contents_view->IsStateActive(AppListModel::STATE_SEARCH_RESULTS));
|
| - EXPECT_EQ(contents_view->GetDefaultSearchBoxBounds(),
|
| - view_->search_box_view()->bounds());
|
| + EXPECT_TRUE(
|
| + CheckSearchBoxWidget(contents_view->GetDefaultSearchBoxBounds()));
|
| }
|
|
|
| Close();
|
|
|