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

Side by Side Diff: ash/wm/overview/window_selector_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 | « ash/test/ash_test_helper_unittest.cc ('k') | chrome/test/base/browser_with_test_window_test.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 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/aura/wm_window_aura.h" 8 #include "ash/aura/wm_window_aura.h"
9 #include "ash/common/accessibility_delegate.h" 9 #include "ash/common/accessibility_delegate.h"
10 #include "ash/common/accessibility_types.h" 10 #include "ash/common/accessibility_types.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // TODO(bruthig): Move all non-simple method definitions out of class 106 // TODO(bruthig): Move all non-simple method definitions out of class
107 // declaration. 107 // declaration.
108 class WindowSelectorTest 108 class WindowSelectorTest
109 : public test::AshTestBase, 109 : public test::AshTestBase,
110 public testing::WithParamInterface<ash::MaterialDesignController::Mode> { 110 public testing::WithParamInterface<ash::MaterialDesignController::Mode> {
111 public: 111 public:
112 WindowSelectorTest() {} 112 WindowSelectorTest() {}
113 ~WindowSelectorTest() override {} 113 ~WindowSelectorTest() override {}
114 114
115 void SetUp() override { 115 void SetUp() override {
116 set_material_mode(GetParam());
116 test::AshTestBase::SetUp(); 117 test::AshTestBase::SetUp();
117 material_design_state_.reset(
118 new test::MaterialDesignControllerTestAPI(GetParam()));
119 if (!ash::MaterialDesignController::IsOverviewMaterial()) { 118 if (!ash::MaterialDesignController::IsOverviewMaterial()) {
120 base::CommandLine::ForCurrentProcess()->AppendSwitch( 119 base::CommandLine::ForCurrentProcess()->AppendSwitch(
121 switches::kAshEnableStableOverviewOrder); 120 switches::kAshEnableStableOverviewOrder);
122 } 121 }
123 ASSERT_TRUE(test::TestShelfDelegate::instance()); 122 ASSERT_TRUE(test::TestShelfDelegate::instance());
124 123
125 shelf_view_test_.reset(new test::ShelfViewTestAPI( 124 shelf_view_test_.reset(new test::ShelfViewTestAPI(
126 test::ShelfTestAPI(Shelf::ForPrimaryDisplay()).shelf_view())); 125 test::ShelfTestAPI(Shelf::ForPrimaryDisplay()).shelf_view()));
127 shelf_view_test_->SetAnimationDuration(1); 126 shelf_view_test_->SetAnimationDuration(1);
128 ScopedTransformOverviewWindow::SetImmediateCloseForTests(); 127 ScopedTransformOverviewWindow::SetImmediateCloseForTests();
129 } 128 }
130 129
131 void TearDown() override {
132 material_design_state_.reset();
133 test::AshTestBase::TearDown();
134 }
135
136 aura::Window* CreateWindow(const gfx::Rect& bounds) { 130 aura::Window* CreateWindow(const gfx::Rect& bounds) {
137 return CreateTestWindowInShellWithDelegate(&delegate_, -1, bounds); 131 return CreateTestWindowInShellWithDelegate(&delegate_, -1, bounds);
138 } 132 }
139 133
140 aura::Window* CreateWindowWithId(const gfx::Rect& bounds, int id) { 134 aura::Window* CreateWindowWithId(const gfx::Rect& bounds, int id) {
141 return CreateTestWindowInShellWithDelegate(&delegate_, id, bounds); 135 return CreateTestWindowInShellWithDelegate(&delegate_, id, bounds);
142 } 136 }
143 aura::Window* CreateNonActivatableWindow(const gfx::Rect& bounds) { 137 aura::Window* CreateNonActivatableWindow(const gfx::Rect& bounds) {
144 aura::Window* window = CreateWindow(bounds); 138 aura::Window* window = CreateWindow(bounds);
145 aura::client::SetActivationDelegate(window, 139 aura::client::SetActivationDelegate(window,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 test::ShelfViewTestAPI* shelf_view_test() { return shelf_view_test_.get(); } 326 test::ShelfViewTestAPI* shelf_view_test() { return shelf_view_test_.get(); }
333 327
334 views::Widget* text_filter_widget() { 328 views::Widget* text_filter_widget() {
335 return window_selector()->text_filter_widget_.get(); 329 return window_selector()->text_filter_widget_.get();
336 } 330 }
337 331
338 private: 332 private:
339 aura::test::TestWindowDelegate delegate_; 333 aura::test::TestWindowDelegate delegate_;
340 NonActivatableActivationDelegate non_activatable_activation_delegate_; 334 NonActivatableActivationDelegate non_activatable_activation_delegate_;
341 std::unique_ptr<test::ShelfViewTestAPI> shelf_view_test_; 335 std::unique_ptr<test::ShelfViewTestAPI> shelf_view_test_;
342 std::unique_ptr<test::MaterialDesignControllerTestAPI> material_design_state_;
343 336
344 DISALLOW_COPY_AND_ASSIGN(WindowSelectorTest); 337 DISALLOW_COPY_AND_ASSIGN(WindowSelectorTest);
345 }; 338 };
346 339
347 // Note: First argument is optional and intentionally left blank. 340 // Note: First argument is optional and intentionally left blank.
348 // (it's a prefix for the generated test cases) 341 // (it's a prefix for the generated test cases)
349 INSTANTIATE_TEST_CASE_P( 342 INSTANTIATE_TEST_CASE_P(
350 , 343 ,
351 WindowSelectorTest, 344 WindowSelectorTest,
352 testing::Values(ash::MaterialDesignController::NON_MATERIAL, 345 testing::Values(ash::MaterialDesignController::NON_MATERIAL,
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 bounds.y()); 2058 bounds.y());
2066 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); 2059 EXPECT_LE(transformed_rect.bottom(), bounds.bottom());
2067 EXPECT_NEAR(transformed_rect.x() - bounds.x(), 2060 EXPECT_NEAR(transformed_rect.x() - bounds.x(),
2068 bounds.right() - transformed_rect.right(), 1); 2061 bounds.right() - transformed_rect.right(), 1);
2069 EXPECT_NEAR( 2062 EXPECT_NEAR(
2070 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), 2063 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(),
2071 bounds.bottom() - transformed_rect.bottom(), 1); 2064 bounds.bottom() - transformed_rect.bottom(), 1);
2072 } 2065 }
2073 2066
2074 } // namespace ash 2067 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_helper_unittest.cc ('k') | chrome/test/base/browser_with_test_window_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698