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

Unified Diff: ui/app_list/views/app_list_view_unittest.cc

Issue 770813004: Make app list search box into a Widget. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@matt_remove_dummy_search_box
Patch Set: addTODO Created 6 years 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 | « ui/app_list/views/app_list_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 94fbd56ebb5c37795edcc9161fe5ce30d745666a..b8e75d84bc0c974e1850492e781ab8da760a6059 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();
@@ -263,6 +267,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();
}
@@ -602,8 +615,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());
@@ -614,16 +627,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());
@@ -635,8 +648,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();
« no previous file with comments | « ui/app_list/views/app_list_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698