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

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

Issue 2379863002: Fix object ownership in ui/base/models. (Closed)
Patch Set: fix Created 4 years, 2 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
« no previous file with comments | « ui/app_list/search/mixer.cc ('k') | ui/app_list/views/search_result_list_view_unittest.cc » ('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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 SimulateClick(all_apps_button); 407 SimulateClick(all_apps_button);
408 main_view->contents_view()->Layout(); 408 main_view->contents_view()->Layout();
409 EXPECT_TRUE(IsStateShown(AppListModel::STATE_APPS)); 409 EXPECT_TRUE(IsStateShown(AppListModel::STATE_APPS));
410 410
411 // Hiding and showing the search box should not affect the app list's 411 // Hiding and showing the search box should not affect the app list's
412 // preferred size. This is a regression test for http://crbug.com/386912. 412 // preferred size. This is a regression test for http://crbug.com/386912.
413 EXPECT_EQ(view_size.ToString(), view_->GetPreferredSize().ToString()); 413 EXPECT_EQ(view_size.ToString(), view_->GetPreferredSize().ToString());
414 414
415 // Check tiles hide and show on deletion and addition. 415 // Check tiles hide and show on deletion and addition.
416 EXPECT_TRUE(SetAppListState(AppListModel::STATE_START)); 416 EXPECT_TRUE(SetAppListState(AppListModel::STATE_START));
417 model->results()->Add(new TestStartPageSearchResult()); 417 model->results()->Add(base::MakeUnique<TestStartPageSearchResult>());
418 start_page_view->UpdateForTesting(); 418 start_page_view->UpdateForTesting();
419 EXPECT_EQ(1u, GetVisibleViews(start_page_view->tile_views())); 419 EXPECT_EQ(1u, GetVisibleViews(start_page_view->tile_views()));
420 model->results()->DeleteAll(); 420 model->results()->DeleteAll();
421 start_page_view->UpdateForTesting(); 421 start_page_view->UpdateForTesting();
422 EXPECT_EQ(0u, GetVisibleViews(start_page_view->tile_views())); 422 EXPECT_EQ(0u, GetVisibleViews(start_page_view->tile_views()));
423 423
424 // Tiles should not update when the start page is not active but should be 424 // Tiles should not update when the start page is not active but should be
425 // correct once the start page is shown. 425 // correct once the start page is shown.
426 EXPECT_TRUE(SetAppListState(AppListModel::STATE_APPS)); 426 EXPECT_TRUE(SetAppListState(AppListModel::STATE_APPS));
427 model->results()->Add(new TestStartPageSearchResult()); 427 model->results()->Add(base::MakeUnique<TestStartPageSearchResult>());
428 start_page_view->UpdateForTesting(); 428 start_page_view->UpdateForTesting();
429 EXPECT_EQ(0u, GetVisibleViews(start_page_view->tile_views())); 429 EXPECT_EQ(0u, GetVisibleViews(start_page_view->tile_views()));
430 EXPECT_TRUE(SetAppListState(AppListModel::STATE_START)); 430 EXPECT_TRUE(SetAppListState(AppListModel::STATE_START));
431 EXPECT_EQ(1u, GetVisibleViews(start_page_view->tile_views())); 431 EXPECT_EQ(1u, GetVisibleViews(start_page_view->tile_views()));
432 432
433 Close(); 433 Close();
434 } 434 }
435 435
436 void AppListViewTestContext::RunPageSwitchingAnimationTest() { 436 void AppListViewTestContext::RunPageSwitchingAnimationTest() {
437 Show(); 437 Show();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 481
482 // The original ContentsView is destroyed here. 482 // The original ContentsView is destroyed here.
483 view_->SetProfileByPath(base::FilePath()); 483 view_->SetProfileByPath(base::FilePath());
484 EXPECT_EQ(1, GetPaginationModel()->total_pages()); 484 EXPECT_EQ(1, GetPaginationModel()->total_pages());
485 485
486 StartPageView* start_page_view = 486 StartPageView* start_page_view =
487 view_->app_list_main_view()->contents_view()->start_page_view(); 487 view_->app_list_main_view()->contents_view()->start_page_view();
488 EXPECT_NO_FATAL_FAILURE(CheckView(start_page_view)); 488 EXPECT_NO_FATAL_FAILURE(CheckView(start_page_view));
489 489
490 // New model updates should be processed by the start page view. 490 // New model updates should be processed by the start page view.
491 delegate_->GetTestModel()->results()->Add(new TestStartPageSearchResult()); 491 delegate_->GetTestModel()->results()->Add(
492 base::MakeUnique<TestStartPageSearchResult>());
492 start_page_view->UpdateForTesting(); 493 start_page_view->UpdateForTesting();
493 EXPECT_EQ(1u, GetVisibleViews(start_page_view->tile_views())); 494 EXPECT_EQ(1u, GetVisibleViews(start_page_view->tile_views()));
494 495
495 // Old model updates should be ignored. 496 // Old model updates should be ignored.
496 original_test_model->results()->Add(new TestStartPageSearchResult()); 497 original_test_model->results()->Add(
497 original_test_model->results()->Add(new TestStartPageSearchResult()); 498 base::MakeUnique<TestStartPageSearchResult>());
499 original_test_model->results()->Add(
500 base::MakeUnique<TestStartPageSearchResult>());
498 start_page_view->UpdateForTesting(); 501 start_page_view->UpdateForTesting();
499 EXPECT_EQ(1u, GetVisibleViews(start_page_view->tile_views())); 502 EXPECT_EQ(1u, GetVisibleViews(start_page_view->tile_views()));
500 503
501 Close(); 504 Close();
502 } 505 }
503 506
504 void AppListViewTestContext::RunSearchResultsTest() { 507 void AppListViewTestContext::RunSearchResultsTest() {
505 EXPECT_FALSE(view_->GetWidget()->IsVisible()); 508 EXPECT_FALSE(view_->GetWidget()->IsVisible());
506 EXPECT_EQ(-1, GetPaginationModel()->total_pages()); 509 EXPECT_EQ(-1, GetPaginationModel()->total_pages());
507 AppListTestModel* model = delegate_->GetTestModel(); 510 AppListTestModel* model = delegate_->GetTestModel();
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 TEST_F(AppListViewTestAura, AppListOverlayTest) { 751 TEST_F(AppListViewTestAura, AppListOverlayTest) {
749 EXPECT_NO_FATAL_FAILURE(test_context_->RunAppListOverlayTest()); 752 EXPECT_NO_FATAL_FAILURE(test_context_->RunAppListOverlayTest());
750 } 753 }
751 754
752 TEST_F(AppListViewTestDesktop, AppListOverlayTest) { 755 TEST_F(AppListViewTestDesktop, AppListOverlayTest) {
753 EXPECT_NO_FATAL_FAILURE(test_context_->RunAppListOverlayTest()); 756 EXPECT_NO_FATAL_FAILURE(test_context_->RunAppListOverlayTest());
754 } 757 }
755 758
756 } // namespace test 759 } // namespace test
757 } // namespace app_list 760 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/search/mixer.cc ('k') | ui/app_list/views/search_result_list_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698