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

Side by Side Diff: ash/test/ash_md_test_base.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_md_test_base.h ('k') | ash/test/ash_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/test/ash_md_test_base.h" 5 #include "ash/test/ash_md_test_base.h"
6 6
7 #include "ash/common/shelf/shelf_constants.h" 7 #include "ash/common/shelf/shelf_constants.h"
8 #include "ash/test/material_design_controller_test_api.h" 8 #include "ash/test/material_design_controller_test_api.h"
9 9
10 namespace ash { 10 namespace ash {
11 namespace test { 11 namespace test {
12 12
13 AshMDTestBase::AshMDTestBase() {} 13 AshMDTestBase::AshMDTestBase() {}
14 14
15 AshMDTestBase::~AshMDTestBase() {} 15 AshMDTestBase::~AshMDTestBase() {}
16 16
17 void AshMDTestBase::SetUp() { 17 void AshMDTestBase::SetUp() {
18 int non_md_shelf_size = 0;
19 int non_md_auto_hide_shelf_size = 0;
20 int md_shelf_size = 0;
21 int md_auto_hide_shelf_size = 0;
22
23 {
24 test::MaterialDesignControllerTestAPI md_state(
25 MaterialDesignController::Mode::NON_MATERIAL);
26 non_md_shelf_size = GetShelfConstant(SHELF_SIZE);
27 non_md_auto_hide_shelf_size = GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE);
28 }
29
30 {
31 test::MaterialDesignControllerTestAPI md_state(GetParam());
32 md_shelf_size = GetShelfConstant(SHELF_SIZE);
33 md_auto_hide_shelf_size = GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE);
34 }
35
36 md_maximized_window_height_offset_ = non_md_shelf_size - md_shelf_size;
37 md_auto_hidden_shelf_height_offset_ =
38 non_md_auto_hide_shelf_size - md_auto_hide_shelf_size;
39
40 set_material_mode(GetParam());
41
18 AshTestBase::SetUp(); 42 AshTestBase::SetUp();
19
20 material_design_state_.reset(new test::MaterialDesignControllerTestAPI(
21 MaterialDesignController::Mode::NON_MATERIAL));
22 const int non_md_shelf_size = GetShelfConstant(SHELF_SIZE);
23 const int non_md_auto_hide_shelf_size =
24 GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE);
25
26 material_design_state_.reset(
27 new test::MaterialDesignControllerTestAPI(GetParam()));
28 const int md_state_shelf_size = GetShelfConstant(SHELF_SIZE);
29 const int md_state_auto_hide_shelf_size =
30 GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE);
31
32 md_maximized_window_height_offset_ = non_md_shelf_size - md_state_shelf_size;
33 md_auto_hidden_shelf_height_offset_ =
34 non_md_auto_hide_shelf_size - md_state_auto_hide_shelf_size;
35 }
36
37 void AshMDTestBase::TearDown() {
38 material_design_state_.reset();
39 AshTestBase::TearDown();
40 } 43 }
41 44
42 int AshMDTestBase::GetMdMaximizedWindowHeightOffset() { 45 int AshMDTestBase::GetMdMaximizedWindowHeightOffset() {
43 return md_maximized_window_height_offset_; 46 return md_maximized_window_height_offset_;
44 } 47 }
45 48
46 int AshMDTestBase::GetMdAutoHiddenShelfHeightOffset() { 49 int AshMDTestBase::GetMdAutoHiddenShelfHeightOffset() {
47 return md_auto_hidden_shelf_height_offset_; 50 return md_auto_hidden_shelf_height_offset_;
48 } 51 }
49 52
50 } // namespace test 53 } // namespace test
51 } // namespace ash 54 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_md_test_base.h ('k') | ash/test/ash_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698