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

Side by Side Diff: ash/test/ash_test_base.h

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.cc ('k') | ash/test/ash_test_base.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 (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 #ifndef ASH_TEST_ASH_TEST_BASE_H_ 5 #ifndef ASH_TEST_ASH_TEST_BASE_H_
6 #define ASH_TEST_ASH_TEST_BASE_H_ 6 #define ASH_TEST_ASH_TEST_BASE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 12
13 #include "ash/common/material_design/material_design_controller.h"
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
16 #include "base/threading/thread.h" 17 #include "base/threading/thread.h"
17 #include "content/public/test/test_browser_thread_bundle.h" 18 #include "content/public/test/test_browser_thread_bundle.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "third_party/skia/include/core/SkColor.h" 20 #include "third_party/skia/include/core/SkColor.h"
20 #include "ui/display/display.h" 21 #include "ui/display/display.h"
21 #include "ui/wm/public/window_types.h" 22 #include "ui/wm/public/window_types.h"
22 23
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 static bool SupportsMultipleDisplays(); 132 static bool SupportsMultipleDisplays();
132 133
133 // Proxy to AshTestHelper::SupportsHostWindowResize(). 134 // Proxy to AshTestHelper::SupportsHostWindowResize().
134 static bool SupportsHostWindowResize(); 135 static bool SupportsHostWindowResize();
135 136
136 // Returns the WmShelf for the primary display. 137 // Returns the WmShelf for the primary display.
137 static WmShelf* GetPrimaryShelf(); 138 static WmShelf* GetPrimaryShelf();
138 139
139 void set_start_session(bool start_session) { start_session_ = start_session; } 140 void set_start_session(bool start_session) { start_session_ = start_session; }
140 141
142 // Sets material mode for the test. This will override material mode set via
143 // command line switches.
144 void set_material_mode(MaterialDesignController::Mode material_mode) {
145 CHECK(!setup_called_);
146 material_mode_ = material_mode;
147 }
148
141 AshTestHelper* ash_test_helper() { return ash_test_helper_.get(); } 149 AshTestHelper* ash_test_helper() { return ash_test_helper_.get(); }
142 150
143 void RunAllPendingInMessageLoop(); 151 void RunAllPendingInMessageLoop();
144 152
145 TestScreenshotDelegate* GetScreenshotDelegate(); 153 TestScreenshotDelegate* GetScreenshotDelegate();
146 154
147 TestSystemTrayDelegate* GetSystemTrayDelegate(); 155 TestSystemTrayDelegate* GetSystemTrayDelegate();
148 156
149 // Utility methods to emulate user logged in or not, session started or not 157 // Utility methods to emulate user logged in or not, session started or not
150 // and user able to lock screen or not cases. 158 // and user able to lock screen or not cases.
(...skipping 12 matching lines...) Expand all
163 void BlockUserSession(UserSessionBlockReason block_reason); 171 void BlockUserSession(UserSessionBlockReason block_reason);
164 void UnblockUserSession(); 172 void UnblockUserSession();
165 173
166 void DisableIME(); 174 void DisableIME();
167 175
168 private: 176 private:
169 bool setup_called_; 177 bool setup_called_;
170 bool teardown_called_; 178 bool teardown_called_;
171 // |SetUp()| doesn't activate session if this is set to false. 179 // |SetUp()| doesn't activate session if this is set to false.
172 bool start_session_; 180 bool start_session_;
181 MaterialDesignController::Mode material_mode_;
173 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; 182 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_;
174 std::unique_ptr<AshTestHelper> ash_test_helper_; 183 std::unique_ptr<AshTestHelper> ash_test_helper_;
175 std::unique_ptr<ui::test::EventGenerator> event_generator_; 184 std::unique_ptr<ui::test::EventGenerator> event_generator_;
176 #if defined(OS_WIN) 185 #if defined(OS_WIN)
177 ui::ScopedOleInitializer ole_initializer_; 186 ui::ScopedOleInitializer ole_initializer_;
178 #endif 187 #endif
179 188
180 DISALLOW_COPY_AND_ASSIGN(AshTestBase); 189 DISALLOW_COPY_AND_ASSIGN(AshTestBase);
181 }; 190 };
182 191
183 class NoSessionAshTestBase : public AshTestBase { 192 class NoSessionAshTestBase : public AshTestBase {
184 public: 193 public:
185 NoSessionAshTestBase() { set_start_session(false); } 194 NoSessionAshTestBase() { set_start_session(false); }
186 ~NoSessionAshTestBase() override {} 195 ~NoSessionAshTestBase() override {}
187 196
188 private: 197 private:
189 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); 198 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase);
190 }; 199 };
191 200
192 } // namespace test 201 } // namespace test
193 } // namespace ash 202 } // namespace ash
194 203
195 #endif // ASH_TEST_ASH_TEST_BASE_H_ 204 #endif // ASH_TEST_ASH_TEST_BASE_H_
OLDNEW
« no previous file with comments | « ash/test/ash_md_test_base.cc ('k') | ash/test/ash_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698