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

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

Issue 2186363002: Set Ash material design mode in tests properly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments Created 4 years, 4 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 | « no previous file | ash/test/ash_md_test_base.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 (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 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 } 2109 }
2110 2110
2111 private: 2111 private:
2112 std::unique_ptr<TestAppListPresenter> app_list_presenter_; 2112 std::unique_ptr<TestAppListPresenter> app_list_presenter_;
2113 2113
2114 DISALLOW_COPY_AND_ASSIGN(TestAppListShellDelegate); 2114 DISALLOW_COPY_AND_ASSIGN(TestAppListShellDelegate);
2115 }; 2115 };
2116 2116
2117 } // namespace 2117 } // namespace
2118 2118
2119 // Test fixture that forces material design mode in order to test ink drop
2120 // ripples on shelf.
2119 class ShelfViewInkDropTest : public ShelfViewTest { 2121 class ShelfViewInkDropTest : public ShelfViewTest {
2120 public: 2122 public:
2121 ShelfViewInkDropTest() {} 2123 ShelfViewInkDropTest() {}
2122 ~ShelfViewInkDropTest() override {} 2124 ~ShelfViewInkDropTest() override {}
2123 2125
2124 void SetUp() override { 2126 void SetUp() override {
2125 shell_delegate_ = new TestAppListShellDelegate; 2127 shell_delegate_ = new TestAppListShellDelegate;
2126 ash_test_helper()->set_test_shell_delegate(shell_delegate_); 2128 ash_test_helper()->set_test_shell_delegate(shell_delegate_);
2127 2129
2130 set_material_mode(ash::MaterialDesignController::MATERIAL_EXPERIMENTAL);
2131
2128 ShelfViewTest::SetUp(); 2132 ShelfViewTest::SetUp();
2129
2130 // TODO(mohsen): Ideally, we would want to set material mode before calling
2131 // ShelfViewTest::SetUp() so that everything is set up with the correct
2132 // material mode. Currently, this is not possible as it expects material
2133 // mode be UNINITIALIZED. (See https://crbug.com/620093)
2134 ash_md_controller_.reset(new ash::test::MaterialDesignControllerTestAPI(
2135 ash::MaterialDesignController::MATERIAL_EXPERIMENTAL));
2136 }
2137
2138 void TearDown() override {
2139 ash_md_controller_.reset();
2140
2141 ShelfViewTest::TearDown();
2142 } 2133 }
2143 2134
2144 protected: 2135 protected:
2145 void InitAppListButtonInkDrop() { 2136 void InitAppListButtonInkDrop() {
2146 app_list_button_ = shelf_view_->GetAppListButton(); 2137 app_list_button_ = shelf_view_->GetAppListButton();
2147 2138
2148 views::InkDropImpl* ink_drop_impl = 2139 views::InkDropImpl* ink_drop_impl =
2149 new views::InkDropImpl(app_list_button_); 2140 new views::InkDropImpl(app_list_button_);
2150 app_list_button_ink_drop_ = new InkDropSpy(base::WrapUnique(ink_drop_impl)); 2141 app_list_button_ink_drop_ = new InkDropSpy(base::WrapUnique(ink_drop_impl));
2151 views::test::InkDropHostViewTestApi(app_list_button_) 2142 views::test::InkDropHostViewTestApi(app_list_button_)
(...skipping 20 matching lines...) Expand all
2172 shell_delegate_->app_list_presenter()->Dismiss(); 2163 shell_delegate_->app_list_presenter()->Dismiss();
2173 // Similar to real AppListPresenter, notify button that the app list is 2164 // Similar to real AppListPresenter, notify button that the app list is
2174 // dismissed. 2165 // dismissed.
2175 app_list_button_->OnAppListDismissed(); 2166 app_list_button_->OnAppListDismissed();
2176 } 2167 }
2177 2168
2178 void FinishAppListVisibilityChange() { 2169 void FinishAppListVisibilityChange() {
2179 shell_delegate_->app_list_presenter()->FinishVisibilityChange(); 2170 shell_delegate_->app_list_presenter()->FinishVisibilityChange();
2180 } 2171 }
2181 2172
2182 std::unique_ptr<ash::test::MaterialDesignControllerTestAPI>
2183 ash_md_controller_;
2184
2185 TestAppListShellDelegate* shell_delegate_ = nullptr; // Owned by Shell. 2173 TestAppListShellDelegate* shell_delegate_ = nullptr; // Owned by Shell.
2186 2174
2187 AppListButton* app_list_button_ = nullptr; 2175 AppListButton* app_list_button_ = nullptr;
2188 InkDropSpy* app_list_button_ink_drop_ = nullptr; 2176 InkDropSpy* app_list_button_ink_drop_ = nullptr;
2189 ShelfButton* browser_button_ = nullptr; 2177 ShelfButton* browser_button_ = nullptr;
2190 InkDropSpy* browser_button_ink_drop_ = nullptr; 2178 InkDropSpy* browser_button_ink_drop_ = nullptr;
2191 2179
2192 private: 2180 private:
2193 DISALLOW_COPY_AND_ASSIGN(ShelfViewInkDropTest); 2181 DISALLOW_COPY_AND_ASSIGN(ShelfViewInkDropTest);
2194 }; 2182 };
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
2575 test_api_->CloseMenu(); 2563 test_api_->CloseMenu();
2576 EXPECT_EQ(views::InkDropState::HIDDEN, 2564 EXPECT_EQ(views::InkDropState::HIDDEN,
2577 browser_button_ink_drop_->GetTargetInkDropState()); 2565 browser_button_ink_drop_->GetTargetInkDropState());
2578 EXPECT_THAT(browser_button_ink_drop_->GetAndResetRequestedStates(), 2566 EXPECT_THAT(browser_button_ink_drop_->GetAndResetRequestedStates(),
2579 ElementsAre(views::InkDropState::ACTIVATED, 2567 ElementsAre(views::InkDropState::ACTIVATED,
2580 views::InkDropState::DEACTIVATED)); 2568 views::InkDropState::DEACTIVATED));
2581 } 2569 }
2582 2570
2583 } // namespace test 2571 } // namespace test
2584 } // namespace ash 2572 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/test/ash_md_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698