1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ASH_TEST_SHELL_DELEGATE_H_
6 #define ASH_TEST_SHELL_DELEGATE_H_
11 #include "ash/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h"
12 #include "ash/shell_delegate.h"
13 #include "base/callback.h"
14 #include "mojo/public/cpp/bindings/pending_receiver.h"
19 class TestShellDelegate : public ShellDelegate {
23 TestShellDelegate(const TestShellDelegate&) = delete;
24 TestShellDelegate& operator=(const TestShellDelegate&) = delete;
26 ~TestShellDelegate() override;
28 // Allows tests to override the MultiDeviceSetup binding behavior for this
30 using MultiDeviceSetupBinder = base::RepeatingCallback<void(
31 mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup>)>;
32 void SetMultiDeviceSetupBinder(MultiDeviceSetupBinder binder) {
33 multidevice_setup_binder_ = std::move(binder);
36 // Overridden from ShellDelegate:
37 bool CanShowWindowForUser(const aura::Window* window) const override;
38 std::unique_ptr<CaptureModeDelegate> CreateCaptureModeDelegate()
40 std::unique_ptr<GlanceablesDelegate> CreateGlanceablesDelegate(
41 GlanceablesController* controller) const override;
42 AccessibilityDelegate* CreateAccessibilityDelegate() override;
43 std::unique_ptr<BackGestureContextualNudgeDelegate>
44 CreateBackGestureContextualNudgeDelegate(
45 BackGestureContextualNudgeController* controller) override;
46 std::unique_ptr<NearbyShareDelegate> CreateNearbyShareDelegate(
47 NearbyShareController* controller) const override;
48 std::unique_ptr<DesksTemplatesDelegate> CreateDesksTemplatesDelegate()
50 scoped_refptr<network::SharedURLLoaderFactory>
51 GetGeolocationUrlLoaderFactory() const override;
52 bool CanGoBack(gfx::NativeWindow window) const override;
53 void SetTabScrubberChromeOSEnabled(bool enabled) override;
54 void ShouldExitFullscreenBeforeLock(
55 ShouldExitFullscreenCallback callback) override;
56 bool ShouldWaitForTouchPressAck(gfx::NativeWindow window) override;
57 int GetBrowserWebUITabStripHeight() override;
58 void BindMultiDeviceSetup(
59 mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup>
61 void BindMultiCaptureService(
62 mojo::PendingReceiver<video_capture::mojom::MultiCaptureService> receiver)
64 bool IsSessionRestoreInProgress() const override;
65 void SetUpEnvironmentForLockedFullscreen(bool locked) override {}
66 const GURL& GetLastCommittedURLForWindowIfAny(aura::Window* window) override;
67 void ForceSkipWarningUserOnClose(
68 const std::vector<aura::Window*>& windows) override {}
70 void SetCanGoBack(bool can_go_back);
71 void SetShouldExitFullscreenBeforeLock(
72 bool should_exit_fullscreen_before_lock);
73 void SetShouldWaitForTouchAck(bool should_wait_for_touch_ack);
74 void SetSessionRestoreInProgress(bool in_progress);
75 bool IsLoggingRedirectDisabled() const override;
76 base::FilePath GetPrimaryUserDownloadsFolder() const override;
77 void OpenFeedbackPageForPersistentDesksBar() override {}
78 void SetLastCommittedURLForWindow(const GURL& url);
79 version_info::Channel GetChannel() override;
80 std::string GetVersionString() override;
82 void set_channel(version_info::Channel channel) { channel_ = channel; }
84 void set_version_string(const std::string& string) {
85 version_string_ = string;
89 // True if the current top window can go back.
90 bool can_go_back_ = true;
92 // True if the tab scrubber is enabled.
93 bool tab_scrubber_enabled_ = true;
95 // False if it is allowed by policy to keep fullscreen after unlock.
96 bool should_exit_fullscreen_before_lock_ = true;
98 // True if when performing back gesture on the top window, we should handle
99 // the event after the touch ack is received. Please refer to
100 // |BackGestureEventHandler::should_wait_for_touch_ack_| for detailed
102 bool should_wait_for_touch_ack_ = false;
104 // True if window browser sessions are restoring.
105 bool session_restore_in_progress_ = false;
107 MultiDeviceSetupBinder multidevice_setup_binder_;
109 GURL last_committed_url_ = GURL::EmptyGURL();
111 version_info::Channel channel_ = version_info::Channel::UNKNOWN;
113 std::string version_string_;
118 #endif // ASH_TEST_SHELL_DELEGATE_H_