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

Side by Side Diff: ash/shelf/shelf_view_unittest.cc

Issue 2177663002: mash: Move ownership of ShelfDelegate to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix wallpaper tests again Created 4 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
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/shelf/shelf_widget.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/shelf/shelf_view.h" 5 #include "ash/shelf/shelf_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 19 matching lines...) Expand all
30 #include "ash/test/overflow_bubble_view_test_api.h" 30 #include "ash/test/overflow_bubble_view_test_api.h"
31 #include "ash/test/shelf_test_api.h" 31 #include "ash/test/shelf_test_api.h"
32 #include "ash/test/shelf_view_test_api.h" 32 #include "ash/test/shelf_view_test_api.h"
33 #include "ash/test/shell_test_api.h" 33 #include "ash/test/shell_test_api.h"
34 #include "ash/test/test_shelf_delegate.h" 34 #include "ash/test/test_shelf_delegate.h"
35 #include "ash/test/test_shelf_item_delegate.h" 35 #include "ash/test/test_shelf_item_delegate.h"
36 #include "ash/test/test_shell_delegate.h" 36 #include "ash/test/test_shell_delegate.h"
37 #include "ash/test/test_system_tray_delegate.h" 37 #include "ash/test/test_system_tray_delegate.h"
38 #include "base/compiler_specific.h" 38 #include "base/compiler_specific.h"
39 #include "base/i18n/rtl.h" 39 #include "base/i18n/rtl.h"
40 #include "base/memory/ptr_util.h"
40 #include "base/run_loop.h" 41 #include "base/run_loop.h"
41 #include "base/strings/string_number_conversions.h" 42 #include "base/strings/string_number_conversions.h"
42 #include "base/strings/utf_string_conversions.h" 43 #include "base/strings/utf_string_conversions.h"
43 #include "base/test/histogram_tester.h" 44 #include "base/test/histogram_tester.h"
44 #include "base/test/user_action_tester.h" 45 #include "base/test/user_action_tester.h"
45 #include "base/threading/thread_task_runner_handle.h" 46 #include "base/threading/thread_task_runner_handle.h"
46 #include "base/time/time.h" 47 #include "base/time/time.h"
47 #include "testing/gmock/include/gmock/gmock.h" 48 #include "testing/gmock/include/gmock/gmock.h"
48 #include "ui/app_list/presenter/app_list_presenter.h" 49 #include "ui/app_list/presenter/app_list_presenter.h"
49 #include "ui/aura/test/aura_test_base.h" 50 #include "ui/aura/test/aura_test_base.h"
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 679 }
679 } 680 }
680 681
681 // Returns the item's ShelfID at |index|. 682 // Returns the item's ShelfID at |index|.
682 ShelfID GetItemId(int index) { 683 ShelfID GetItemId(int index) {
683 DCHECK_GE(index, 0); 684 DCHECK_GE(index, 0);
684 return model_->items()[index].id; 685 return model_->items()[index].id;
685 } 686 }
686 687
687 void ReplaceShelfDelegate() { 688 void ReplaceShelfDelegate() {
688 // Replace ShelfDelegate.
689 ShellTestApi shell_test_api(Shell::GetInstance());
690 shell_test_api.SetShelfDelegate(NULL);
691 shelf_delegate_ = new TestShelfDelegateForShelfView(); 689 shelf_delegate_ = new TestShelfDelegateForShelfView();
692 shell_test_api.SetShelfDelegate(shelf_delegate_);
693 ShelfTestAPI(Shelf::ForPrimaryDisplay()).set_delegate(shelf_delegate_);
694 test_api_->SetShelfDelegate(shelf_delegate_); 690 test_api_->SetShelfDelegate(shelf_delegate_);
691 WmShell::Get()->SetShelfDelegateForTesting(
692 base::WrapUnique(shelf_delegate_));
695 } 693 }
696 694
697 ShelfModel* model_; 695 ShelfModel* model_;
698 ShelfView* shelf_view_; 696 ShelfView* shelf_view_;
699 int browser_index_; 697 int browser_index_;
700 698
701 // Owned by ash::Shell. 699 // Owned by ash::WmShell.
702 TestShelfDelegateForShelfView* shelf_delegate_; 700 TestShelfDelegateForShelfView* shelf_delegate_;
703 701
704 std::unique_ptr<ShelfViewTestAPI> test_api_; 702 std::unique_ptr<ShelfViewTestAPI> test_api_;
705 703
706 private: 704 private:
707 DISALLOW_COPY_AND_ASSIGN(ShelfViewTest); 705 DISALLOW_COPY_AND_ASSIGN(ShelfViewTest);
708 }; 706 };
709 707
710 const char* 708 const char*
711 ShelfViewTest::kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName = 709 ShelfViewTest::kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName =
(...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 test_api_->CloseMenu(); 2581 test_api_->CloseMenu();
2584 EXPECT_EQ(views::InkDropState::HIDDEN, 2582 EXPECT_EQ(views::InkDropState::HIDDEN,
2585 browser_button_ink_drop_->GetTargetInkDropState()); 2583 browser_button_ink_drop_->GetTargetInkDropState());
2586 EXPECT_THAT(browser_button_ink_drop_->GetAndResetRequestedStates(), 2584 EXPECT_THAT(browser_button_ink_drop_->GetAndResetRequestedStates(),
2587 ElementsAre(views::InkDropState::ACTIVATED, 2585 ElementsAre(views::InkDropState::ACTIVATED,
2588 views::InkDropState::DEACTIVATED)); 2586 views::InkDropState::DEACTIVATED));
2589 } 2587 }
2590 2588
2591 } // namespace test 2589 } // namespace test
2592 } // namespace ash 2590 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/shelf/shelf_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698