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

Side by Side Diff: ui/app_list/views/app_list_view_unittest.cc

Issue 377783006: Make app list return to previous page after search. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/app_list/views/contents_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/app_list/views/app_list_view.h" 5 #include "ui/app_list/views/app_list_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 EXPECT_EQ(-1, GetPaginationModel()->total_pages()); 436 EXPECT_EQ(-1, GetPaginationModel()->total_pages());
437 AppListTestModel* model = delegate_->GetTestModel(); 437 AppListTestModel* model = delegate_->GetTestModel();
438 model->PopulateApps(3); 438 model->PopulateApps(3);
439 439
440 Show(); 440 Show();
441 441
442 AppListMainView* main_view = view_->app_list_main_view(); 442 AppListMainView* main_view = view_->app_list_main_view();
443 ContentsView* contents_view = main_view->contents_view(); 443 ContentsView* contents_view = main_view->contents_view();
444 ShowContentsViewPageAndVerify( 444 ShowContentsViewPageAndVerify(
445 contents_view->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS)); 445 contents_view->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS));
446 EXPECT_TRUE(IsViewAtOrigin(contents_view->apps_container_view()));
447 EXPECT_TRUE(main_view->search_box_view()->visible()); 446 EXPECT_TRUE(main_view->search_box_view()->visible());
448 447
449 // Show the search results. 448 // Show the search results.
450 contents_view->ShowSearchResults(true); 449 contents_view->ShowSearchResults(true);
451 contents_view->Layout(); 450 contents_view->Layout();
452 EXPECT_TRUE(contents_view->IsShowingSearchResults()); 451 EXPECT_TRUE(contents_view->IsShowingSearchResults());
453 EXPECT_TRUE(main_view->search_box_view()->visible()); 452 EXPECT_TRUE(main_view->search_box_view()->visible());
454 453
455 if (test_type_ == EXPERIMENTAL) { 454 if (test_type_ == EXPERIMENTAL) {
456 EXPECT_TRUE( 455 EXPECT_TRUE(
457 contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_START)); 456 contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_START));
458 EXPECT_TRUE(IsViewAtOrigin(contents_view->start_page_view())); 457 EXPECT_TRUE(IsViewAtOrigin(contents_view->start_page_view()));
459 } else { 458 } else {
460 EXPECT_TRUE(contents_view->IsNamedPageActive( 459 EXPECT_TRUE(contents_view->IsNamedPageActive(
461 ContentsView::NAMED_PAGE_SEARCH_RESULTS)); 460 ContentsView::NAMED_PAGE_SEARCH_RESULTS));
462 EXPECT_TRUE(IsViewAtOrigin(contents_view->search_results_view())); 461 EXPECT_TRUE(IsViewAtOrigin(contents_view->search_results_view()));
463 } 462 }
464 463
465 // Hide the search results. 464 // Hide the search results.
466 contents_view->ShowSearchResults(false); 465 contents_view->ShowSearchResults(false);
467 contents_view->Layout(); 466 contents_view->Layout();
468 EXPECT_FALSE(contents_view->IsShowingSearchResults()); 467 EXPECT_FALSE(contents_view->IsShowingSearchResults());
469 if (test_type_ == EXPERIMENTAL) { 468
470 EXPECT_TRUE( 469 // Check that we return to the page that we were on before the search.
471 contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_START)); 470 EXPECT_TRUE(contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_APPS));
472 EXPECT_TRUE(IsViewAtOrigin(contents_view->start_page_view())); 471 EXPECT_TRUE(IsViewAtOrigin(contents_view->apps_container_view()));
473 EXPECT_FALSE(main_view->search_box_view()->visible()); 472 EXPECT_TRUE(main_view->search_box_view()->visible());
474 } else {
475 EXPECT_TRUE(
476 contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_APPS));
477 EXPECT_TRUE(IsViewAtOrigin(contents_view->apps_container_view()));
478 EXPECT_TRUE(main_view->search_box_view()->visible());
479 }
480 473
481 if (test_type_ == EXPERIMENTAL) { 474 if (test_type_ == EXPERIMENTAL) {
475 ShowContentsViewPageAndVerify(contents_view->GetPageIndexForNamedPage(
476 ContentsView::NAMED_PAGE_START));
477
482 // Check that typing into the dummy search box triggers the search page. 478 // Check that typing into the dummy search box triggers the search page.
483 base::string16 search_text = base::UTF8ToUTF16("test"); 479 base::string16 search_text = base::UTF8ToUTF16("test");
484 SearchBoxView* dummy_search_box = 480 SearchBoxView* dummy_search_box =
485 contents_view->start_page_view()->dummy_search_box_view(); 481 contents_view->start_page_view()->dummy_search_box_view();
486 EXPECT_TRUE(dummy_search_box->IsDrawn()); 482 EXPECT_TRUE(dummy_search_box->IsDrawn());
487 dummy_search_box->search_box()->InsertText(search_text); 483 dummy_search_box->search_box()->InsertText(search_text);
488 contents_view->Layout(); 484 contents_view->Layout();
489 // Check that the current search is using |search_text|. 485 // Check that the current search is using |search_text|.
490 EXPECT_EQ(search_text, delegate_->GetTestModel()->search_box()->text()); 486 EXPECT_EQ(search_text, delegate_->GetTestModel()->search_box()->text());
491 EXPECT_TRUE(contents_view->IsShowingSearchResults()); 487 EXPECT_TRUE(contents_view->IsShowingSearchResults());
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 INSTANTIATE_TEST_CASE_P(AppListViewTestAuraInstance, 664 INSTANTIATE_TEST_CASE_P(AppListViewTestAuraInstance,
669 AppListViewTestAura, 665 AppListViewTestAura,
670 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); 666 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END));
671 667
672 INSTANTIATE_TEST_CASE_P(AppListViewTestDesktopInstance, 668 INSTANTIATE_TEST_CASE_P(AppListViewTestDesktopInstance,
673 AppListViewTestDesktop, 669 AppListViewTestDesktop,
674 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); 670 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END));
675 671
676 } // namespace test 672 } // namespace test
677 } // namespace app_list 673 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/views/contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698