OLD | NEW |
---|---|
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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
437 EXPECT_EQ(-1, GetPaginationModel()->total_pages()); | 437 EXPECT_EQ(-1, GetPaginationModel()->total_pages()); |
438 AppListTestModel* model = delegate_->GetTestModel(); | 438 AppListTestModel* model = delegate_->GetTestModel(); |
439 model->PopulateApps(3); | 439 model->PopulateApps(3); |
440 | 440 |
441 Show(); | 441 Show(); |
442 | 442 |
443 AppListMainView* main_view = view_->app_list_main_view(); | 443 AppListMainView* main_view = view_->app_list_main_view(); |
444 ContentsView* contents_view = main_view->contents_view(); | 444 ContentsView* contents_view = main_view->contents_view(); |
445 ShowContentsViewPageAndVerify( | 445 ShowContentsViewPageAndVerify( |
446 contents_view->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS)); | 446 contents_view->GetPageIndexForNamedPage(ContentsView::NAMED_PAGE_APPS)); |
447 EXPECT_TRUE(IsViewAtOrigin(contents_view->apps_container_view())); | |
448 EXPECT_TRUE(main_view->search_box_view()->visible()); | 447 EXPECT_TRUE(main_view->search_box_view()->visible()); |
Matt Giuca
2014/07/09 04:42:07
Why did IsViewAtOrigin go away?
calamity
2014/07/11 04:22:17
Wasn't necessary because of ShowContentsViewPageAn
| |
449 | 448 |
450 // Show the search results. | 449 // Show the search results. |
451 contents_view->ShowSearchResults(true); | 450 contents_view->ShowSearchResults(true); |
452 contents_view->Layout(); | 451 contents_view->Layout(); |
453 EXPECT_TRUE(contents_view->IsShowingSearchResults()); | 452 EXPECT_TRUE(contents_view->IsShowingSearchResults()); |
454 EXPECT_TRUE(main_view->search_box_view()->visible()); | 453 EXPECT_TRUE(main_view->search_box_view()->visible()); |
455 | 454 |
456 if (test_type_ == EXPERIMENTAL) { | 455 if (test_type_ == EXPERIMENTAL) { |
457 EXPECT_TRUE( | 456 EXPECT_TRUE( |
458 contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_START)); | 457 contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_START)); |
459 EXPECT_TRUE(IsViewAtOrigin(contents_view->start_page_view())); | 458 EXPECT_TRUE(IsViewAtOrigin(contents_view->start_page_view())); |
460 } else { | 459 } else { |
461 EXPECT_TRUE(contents_view->IsNamedPageActive( | 460 EXPECT_TRUE(contents_view->IsNamedPageActive( |
462 ContentsView::NAMED_PAGE_SEARCH_RESULTS)); | 461 ContentsView::NAMED_PAGE_SEARCH_RESULTS)); |
463 EXPECT_TRUE(IsViewAtOrigin(contents_view->search_results_view())); | 462 EXPECT_TRUE(IsViewAtOrigin(contents_view->search_results_view())); |
464 } | 463 } |
465 | 464 |
466 // Hide the search results. | 465 // Hide the search results. |
467 contents_view->ShowSearchResults(false); | 466 contents_view->ShowSearchResults(false); |
468 contents_view->Layout(); | 467 contents_view->Layout(); |
469 EXPECT_FALSE(contents_view->IsShowingSearchResults()); | 468 EXPECT_FALSE(contents_view->IsShowingSearchResults()); |
470 if (test_type_ == EXPERIMENTAL) { | 469 |
471 EXPECT_TRUE( | 470 // Check that we return to the page that we were on before the search. |
472 contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_START)); | 471 EXPECT_TRUE(contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_APPS)); |
473 EXPECT_TRUE(IsViewAtOrigin(contents_view->start_page_view())); | 472 EXPECT_TRUE(IsViewAtOrigin(contents_view->apps_container_view())); |
474 EXPECT_FALSE(main_view->search_box_view()->visible()); | 473 EXPECT_TRUE(main_view->search_box_view()->visible()); |
475 } else { | |
476 EXPECT_TRUE( | |
477 contents_view->IsNamedPageActive(ContentsView::NAMED_PAGE_APPS)); | |
478 EXPECT_TRUE(IsViewAtOrigin(contents_view->apps_container_view())); | |
479 EXPECT_TRUE(main_view->search_box_view()->visible()); | |
480 } | |
481 | 474 |
482 if (test_type_ == EXPERIMENTAL) { | 475 if (test_type_ == EXPERIMENTAL) { |
476 ShowContentsViewPageAndVerify(contents_view->GetPageIndexForNamedPage( | |
477 ContentsView::NAMED_PAGE_START)); | |
478 | |
483 // Check that typing into the dummy search box triggers the search page. | 479 // Check that typing into the dummy search box triggers the search page. |
484 base::string16 search_text = base::UTF8ToUTF16("test"); | 480 base::string16 search_text = base::UTF8ToUTF16("test"); |
485 SearchBoxView* dummy_search_box = | 481 SearchBoxView* dummy_search_box = |
486 contents_view->start_page_view()->dummy_search_box_view(); | 482 contents_view->start_page_view()->dummy_search_box_view(); |
487 EXPECT_TRUE(dummy_search_box->IsDrawn()); | 483 EXPECT_TRUE(dummy_search_box->IsDrawn()); |
488 dummy_search_box->search_box()->InsertText(search_text); | 484 dummy_search_box->search_box()->InsertText(search_text); |
489 contents_view->Layout(); | 485 contents_view->Layout(); |
490 // Check that the current search is using |search_text|. | 486 // Check that the current search is using |search_text|. |
491 EXPECT_EQ(search_text, delegate_->GetTestModel()->search_box()->text()); | 487 EXPECT_EQ(search_text, delegate_->GetTestModel()->search_box()->text()); |
492 EXPECT_TRUE(contents_view->IsShowingSearchResults()); | 488 EXPECT_TRUE(contents_view->IsShowingSearchResults()); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
669 INSTANTIATE_TEST_CASE_P(AppListViewTestAuraInstance, | 665 INSTANTIATE_TEST_CASE_P(AppListViewTestAuraInstance, |
670 AppListViewTestAura, | 666 AppListViewTestAura, |
671 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); | 667 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); |
672 | 668 |
673 INSTANTIATE_TEST_CASE_P(AppListViewTestDesktopInstance, | 669 INSTANTIATE_TEST_CASE_P(AppListViewTestDesktopInstance, |
674 AppListViewTestDesktop, | 670 AppListViewTestDesktop, |
675 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); | 671 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END)); |
676 | 672 |
677 } // namespace test | 673 } // namespace test |
678 } // namespace app_list | 674 } // namespace app_list |
OLD | NEW |