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

Side by Side Diff: ui/app_list/presenter/app_list_presenter_impl_unittest.cc

Issue 2576913002: Use mojo app list interfaces for mash and classic ash. (Closed)
Patch Set: Add missing dep. Created 3 years, 12 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/presenter/app_list_presenter_impl.h" 5 #include "ui/app_list/presenter/app_list_presenter_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "ui/app_list/presenter/app_list_presenter_delegate_factory.h" 10 #include "ui/app_list/presenter/app_list_presenter_delegate_factory.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 : public AppListPresenterDelegateFactory { 71 : public AppListPresenterDelegateFactory {
72 public: 72 public:
73 explicit AppListPresenterDelegateFactoryTest(aura::Window* container) 73 explicit AppListPresenterDelegateFactoryTest(aura::Window* container)
74 : container_(container) {} 74 : container_(container) {}
75 ~AppListPresenterDelegateFactoryTest() override {} 75 ~AppListPresenterDelegateFactoryTest() override {}
76 76
77 AppListPresenterDelegateTest* current_delegate() { return current_delegate_; } 77 AppListPresenterDelegateTest* current_delegate() { return current_delegate_; }
78 78
79 // AppListPresenterDelegateFactory: 79 // AppListPresenterDelegateFactory:
80 std::unique_ptr<AppListPresenterDelegate> GetDelegate( 80 std::unique_ptr<AppListPresenterDelegate> GetDelegate(
81 AppListPresenter* presenter) override { 81 AppListPresenterImpl* presenter) override {
82 current_delegate_ = 82 current_delegate_ =
83 new AppListPresenterDelegateTest(container_, &app_list_view_delegate_); 83 new AppListPresenterDelegateTest(container_, &app_list_view_delegate_);
84 return base::WrapUnique(current_delegate_); 84 return base::WrapUnique(current_delegate_);
85 } 85 }
86 86
87 private: 87 private:
88 aura::Window* container_; 88 aura::Window* container_;
89 AppListPresenterDelegateTest* current_delegate_ = nullptr; 89 AppListPresenterDelegateTest* current_delegate_ = nullptr;
90 test::AppListTestViewDelegate app_list_view_delegate_; 90 test::AppListTestViewDelegate app_list_view_delegate_;
91 91
(...skipping 15 matching lines...) Expand all
107 // time the app list is shown. 107 // time the app list is shown.
108 AppListPresenterDelegateTest* delegate() { 108 AppListPresenterDelegateTest* delegate() {
109 return factory_->current_delegate(); 109 return factory_->current_delegate();
110 } 110 }
111 111
112 // aura::test::AuraTestBase: 112 // aura::test::AuraTestBase:
113 void SetUp() override; 113 void SetUp() override;
114 void TearDown() override; 114 void TearDown() override;
115 115
116 private: 116 private:
117 std::unique_ptr<AppListPresenterDelegateFactoryTest> factory_;
118 std::unique_ptr<AppListPresenterImpl> presenter_; 117 std::unique_ptr<AppListPresenterImpl> presenter_;
119 std::unique_ptr<aura::Window> container_; 118 std::unique_ptr<aura::Window> container_;
120 119
121 DISALLOW_COPY_AND_ASSIGN(AppListPresenterImplTest); 120 DISALLOW_COPY_AND_ASSIGN(AppListPresenterImplTest);
122 }; 121 };
123 122
124 AppListPresenterImplTest::AppListPresenterImplTest() {} 123 AppListPresenterImplTest::AppListPresenterImplTest() {}
125 124
126 AppListPresenterImplTest::~AppListPresenterImplTest() {} 125 AppListPresenterImplTest::~AppListPresenterImplTest() {}
127 126
128 void AppListPresenterImplTest::SetUp() { 127 void AppListPresenterImplTest::SetUp() {
129 AuraTestBase::SetUp(); 128 AuraTestBase::SetUp();
130 new wm::DefaultActivationClient(root_window()); 129 new wm::DefaultActivationClient(root_window());
131 container_.reset(CreateNormalWindow(0, root_window(), nullptr)); 130 container_.reset(CreateNormalWindow(0, root_window(), nullptr));
132 factory_.reset(new AppListPresenterDelegateFactoryTest(container_.get())); 131 presenter_ = base::MakeUnique<AppListPresenterImpl>(
133 presenter_.reset(new AppListPresenterImpl(factory_.get())); 132 base::MakeUnique<AppListPresenterDelegateFactoryTest>(container_.get()));
134 } 133 }
135 134
136 void AppListPresenterImplTest::TearDown() { 135 void AppListPresenterImplTest::TearDown() {
137 container_.reset(); 136 container_.reset();
138 AuraTestBase::TearDown(); 137 AuraTestBase::TearDown();
139 } 138 }
140 139
141 // Tests that app launcher is dismissed when focus moves to a window which is 140 // Tests that app launcher is dismissed when focus moves to a window which is
142 // not app list window's sibling and that appropriate delegate callbacks are 141 // not app list window's sibling and that appropriate delegate callbacks are
143 // executed when the app launcher is shown and then when the app launcher is 142 // executed when the app launcher is shown and then when the app launcher is
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 TEST_F(AppListPresenterImplTest, WidgetDestroyed) { 201 TEST_F(AppListPresenterImplTest, WidgetDestroyed) {
203 presenter()->Show(GetDisplayId()); 202 presenter()->Show(GetDisplayId());
204 EXPECT_TRUE(presenter()->GetTargetVisibility()); 203 EXPECT_TRUE(presenter()->GetTargetVisibility());
205 presenter()->GetView()->GetWidget()->CloseNow(); 204 presenter()->GetView()->GetWidget()->CloseNow();
206 EXPECT_FALSE(presenter()->GetTargetVisibility()); 205 EXPECT_FALSE(presenter()->GetTargetVisibility());
207 test::AppListPresenterImplTestApi presenter_test_api(presenter()); 206 test::AppListPresenterImplTestApi presenter_test_api(presenter());
208 EXPECT_FALSE(presenter_test_api.presenter_delegate()); 207 EXPECT_FALSE(presenter_test_api.presenter_delegate());
209 } 208 }
210 209
211 } // namespace app_list 210 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698