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

Side by Side Diff: ash/test/ash_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_test_base.h ('k') | ash/test/ash_test_helper.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/test/ash_test_base.h" 5 #include "ash/test/ash_test_base.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 private: 85 private:
86 DISALLOW_COPY_AND_ASSIGN(AshEventGeneratorDelegate); 86 DISALLOW_COPY_AND_ASSIGN(AshEventGeneratorDelegate);
87 }; 87 };
88 88
89 } // namespace 89 } // namespace
90 90
91 ///////////////////////////////////////////////////////////////////////////// 91 /////////////////////////////////////////////////////////////////////////////
92 92
93 AshTestBase::AshTestBase() 93 AshTestBase::AshTestBase()
94 : setup_called_(false), teardown_called_(false), start_session_(true) { 94 : setup_called_(false),
95 teardown_called_(false),
96 start_session_(true),
97 material_mode_(MaterialDesignController::Mode::UNINITIALIZED) {
95 #if defined(USE_X11) 98 #if defined(USE_X11)
96 // This is needed for tests which use this base class but are run in browser 99 // This is needed for tests which use this base class but are run in browser
97 // test binaries so don't get the default initialization in the unit test 100 // test binaries so don't get the default initialization in the unit test
98 // suite. 101 // suite.
99 gfx::InitializeThreadedX11(); 102 gfx::InitializeThreadedX11();
100 #endif 103 #endif
101 104
102 thread_bundle_.reset(new content::TestBrowserThreadBundle); 105 thread_bundle_.reset(new content::TestBrowserThreadBundle);
103 // Must initialize |ash_test_helper_| here because some tests rely on 106 // Must initialize |ash_test_helper_| here because some tests rely on
104 // AshTestBase methods before they call AshTestBase::SetUp(). 107 // AshTestBase methods before they call AshTestBase::SetUp().
(...skipping 18 matching lines...) Expand all
123 // Use the origin (1,1) so that it doesn't over 126 // Use the origin (1,1) so that it doesn't over
124 // lap with the native mouse cursor. 127 // lap with the native mouse cursor.
125 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 128 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
126 if (!command_line->HasSwitch(switches::kAshHostWindowBounds)) { 129 if (!command_line->HasSwitch(switches::kAshHostWindowBounds)) {
127 command_line->AppendSwitchASCII(switches::kAshHostWindowBounds, 130 command_line->AppendSwitchASCII(switches::kAshHostWindowBounds,
128 "1+1-800x600"); 131 "1+1-800x600");
129 } 132 }
130 #if defined(OS_WIN) 133 #if defined(OS_WIN)
131 ui::test::SetUsePopupAsRootWindowForTest(true); 134 ui::test::SetUsePopupAsRootWindowForTest(true);
132 #endif 135 #endif
133 ash_test_helper_->SetUp(start_session_); 136
137 ash_test_helper_->SetUp(start_session_, material_mode_);
134 138
135 Shell::GetPrimaryRootWindow()->Show(); 139 Shell::GetPrimaryRootWindow()->Show();
136 Shell::GetPrimaryRootWindow()->GetHost()->Show(); 140 Shell::GetPrimaryRootWindow()->GetHost()->Show();
137 // Move the mouse cursor to far away so that native events doesn't 141 // Move the mouse cursor to far away so that native events doesn't
138 // interfere test expectations. 142 // interfere test expectations.
139 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); 143 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000));
140 Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); 144 Shell::GetInstance()->cursor_manager()->EnableMouseEvents();
141 145
142 // Changing GestureConfiguration shouldn't make tests fail. These values 146 // Changing GestureConfiguration shouldn't make tests fail. These values
143 // prevent unexpected events from being generated during tests. Such as 147 // prevent unexpected events from being generated during tests. Such as
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 378
375 void AshTestBase::DisableIME() { 379 void AshTestBase::DisableIME() {
376 Shell::GetInstance()->RemovePreTargetHandler( 380 Shell::GetInstance()->RemovePreTargetHandler(
377 Shell::GetInstance() 381 Shell::GetInstance()
378 ->window_tree_host_manager() 382 ->window_tree_host_manager()
379 ->input_method_event_handler()); 383 ->input_method_event_handler());
380 } 384 }
381 385
382 } // namespace test 386 } // namespace test
383 } // namespace ash 387 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_base.h ('k') | ash/test/ash_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698