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

Side by Side Diff: ash/test/test_shell_delegate.cc

Issue 2861873004: Make the pref_service in TestShellDelegate injectable. (Closed)
Patch Set: Created 3 years, 7 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/test_shell_delegate.h ('k') | no next file » | 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/test_shell_delegate.h" 5 #include "ash/test/test_shell_delegate.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "ash/default_accessibility_delegate.h" 9 #include "ash/default_accessibility_delegate.h"
10 #include "ash/gpu_support_stub.h" 10 #include "ash/gpu_support_stub.h"
11 #include "ash/palette_delegate.h" 11 #include "ash/palette_delegate.h"
12 #include "ash/public/cpp/shell_window_ids.h" 12 #include "ash/public/cpp/shell_window_ids.h"
13 #include "ash/root_window_controller.h" 13 #include "ash/root_window_controller.h"
14 #include "ash/session/session_state_delegate.h" 14 #include "ash/session/session_state_delegate.h"
15 #include "ash/shelf/wm_shelf.h" 15 #include "ash/shelf/wm_shelf.h"
16 #include "ash/shell.h" 16 #include "ash/shell.h"
17 #include "ash/shell_observer.h" 17 #include "ash/shell_observer.h"
18 #include "ash/system/tray/system_tray_notifier.h" 18 #include "ash/system/tray/system_tray_notifier.h"
19 #include "ash/test/test_keyboard_ui.h" 19 #include "ash/test/test_keyboard_ui.h"
20 #include "ash/test/test_session_state_delegate.h" 20 #include "ash/test/test_session_state_delegate.h"
21 #include "ash/test/test_system_tray_delegate.h" 21 #include "ash/test/test_system_tray_delegate.h"
22 #include "ash/test/test_wallpaper_delegate.h" 22 #include "ash/test/test_wallpaper_delegate.h"
23 #include "ash/wm/window_state.h" 23 #include "ash/wm/window_state.h"
24 #include "ash/wm/window_util.h" 24 #include "ash/wm/window_util.h"
25 #include "ash/wm_window.h" 25 #include "ash/wm_window.h"
26 #include "base/logging.h" 26 #include "base/logging.h"
27 #include "base/memory/ptr_util.h" 27 #include "base/memory/ptr_util.h"
28 #include "components/prefs/pref_service.h"
29 #include "components/prefs/testing_pref_service.h"
30 #include "ui/aura/window.h" 28 #include "ui/aura/window.h"
31 #include "ui/gfx/image/image.h" 29 #include "ui/gfx/image/image.h"
32 30
33 namespace ash { 31 namespace ash {
34 namespace test { 32 namespace test {
35 33
36 // A ShellObserver that sets the shelf alignment and auto hide behavior when the 34 // A ShellObserver that sets the shelf alignment and auto hide behavior when the
37 // shelf is created, to simulate ChromeLauncherController's behavior. 35 // shelf is created, to simulate ChromeLauncherController's behavior.
38 class ShelfInitializer : public ShellObserver { 36 class ShelfInitializer : public ShellObserver {
39 public: 37 public:
(...skipping 14 matching lines...) Expand all
54 52
55 private: 53 private:
56 DISALLOW_COPY_AND_ASSIGN(ShelfInitializer); 54 DISALLOW_COPY_AND_ASSIGN(ShelfInitializer);
57 }; 55 };
58 56
59 TestShellDelegate::TestShellDelegate() 57 TestShellDelegate::TestShellDelegate()
60 : num_exit_requests_(0), 58 : num_exit_requests_(0),
61 multi_profiles_enabled_(false), 59 multi_profiles_enabled_(false),
62 force_maximize_on_first_run_(false), 60 force_maximize_on_first_run_(false),
63 touchscreen_enabled_in_local_pref_(true), 61 touchscreen_enabled_in_local_pref_(true),
64 pref_service_(base::MakeUnique<TestingPrefServiceSimple>()) {} 62 active_user_pref_service_(nullptr) {}
65 63
66 TestShellDelegate::~TestShellDelegate() {} 64 TestShellDelegate::~TestShellDelegate() {}
67 65
68 ::service_manager::Connector* TestShellDelegate::GetShellConnector() const { 66 ::service_manager::Connector* TestShellDelegate::GetShellConnector() const {
69 return nullptr; 67 return nullptr;
70 } 68 }
71 69
72 bool TestShellDelegate::IsIncognitoAllowed() const { 70 bool TestShellDelegate::IsIncognitoAllowed() const {
73 return true; 71 return true;
74 } 72 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 142
145 base::string16 TestShellDelegate::GetProductName() const { 143 base::string16 TestShellDelegate::GetProductName() const {
146 return base::string16(); 144 return base::string16();
147 } 145 }
148 146
149 gfx::Image TestShellDelegate::GetDeprecatedAcceleratorImage() const { 147 gfx::Image TestShellDelegate::GetDeprecatedAcceleratorImage() const {
150 return gfx::Image(); 148 return gfx::Image();
151 } 149 }
152 150
153 PrefService* TestShellDelegate::GetActiveUserPrefService() const { 151 PrefService* TestShellDelegate::GetActiveUserPrefService() const {
154 return pref_service_.get(); 152 return active_user_pref_service_;
155 } 153 }
156 154
157 bool TestShellDelegate::IsTouchscreenEnabledInPrefs( 155 bool TestShellDelegate::IsTouchscreenEnabledInPrefs(
158 bool use_local_state) const { 156 bool use_local_state) const {
159 return use_local_state ? touchscreen_enabled_in_local_pref_ : true; 157 return use_local_state ? touchscreen_enabled_in_local_pref_ : true;
160 } 158 }
161 159
162 void TestShellDelegate::SetTouchscreenEnabledInPrefs(bool enabled, 160 void TestShellDelegate::SetTouchscreenEnabledInPrefs(bool enabled,
163 bool use_local_state) { 161 bool use_local_state) {
164 if (use_local_state) 162 if (use_local_state)
165 touchscreen_enabled_in_local_pref_ = enabled; 163 touchscreen_enabled_in_local_pref_ = enabled;
166 } 164 }
167 165
168 void TestShellDelegate::UpdateTouchscreenStatusFromPrefs() {} 166 void TestShellDelegate::UpdateTouchscreenStatusFromPrefs() {}
169 167
170 } // namespace test 168 } // namespace test
171 } // namespace ash 169 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/test_shell_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698