Commit 6584d78b authored by Steven Bennetts's avatar Steven Bennetts Committed by Commit Bot

ash::ShellDelegate: elim PreInit

ShellDelegate::PreInit is now only used by
WindowTreeHostManagerStartupTest.Startup which can effectively be tested
by other means.

Bug: 705713
Change-Id: Ieaa394db7603ab14ccaa79059303aff4011af5d0
Reviewed-on: https://chromium-review.googlesource.com/1169432
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583850}
parent 0bac1c32
......@@ -245,52 +245,12 @@ class WindowTreeHostManagerShutdownTest : public AshTestBase,
DISALLOW_COPY_AND_ASSIGN(WindowTreeHostManagerShutdownTest);
};
class StartupHelper : public TestShellDelegate,
public WindowTreeHostManager::Observer {
public:
StartupHelper() : displays_initialized_(false) {}
~StartupHelper() override = default;
// ShellDelegate:
void PreInit() override {
Shell::Get()->window_tree_host_manager()->AddObserver(this);
}
// WindowTreeHostManager::Observer:
void OnDisplaysInitialized() override {
DCHECK(!displays_initialized_);
displays_initialized_ = true;
}
bool displays_initialized() const { return displays_initialized_; }
private:
bool displays_initialized_;
DISALLOW_COPY_AND_ASSIGN(StartupHelper);
};
class WindowTreeHostManagerStartupTest : public AshTestBase, public TestHelper {
public:
WindowTreeHostManagerStartupTest()
: TestHelper(this), startup_helper_(new StartupHelper) {}
WindowTreeHostManagerStartupTest() : TestHelper(this) {}
~WindowTreeHostManagerStartupTest() override = default;
// AshTestBase:
void SetUp() override {
ash_test_helper()->set_test_shell_delegate(startup_helper_);
AshTestBase::SetUp();
}
void TearDown() override {
Shell::Get()->window_tree_host_manager()->RemoveObserver(startup_helper_);
AshTestBase::TearDown();
}
const StartupHelper* startup_helper() const { return startup_helper_; }
private:
StartupHelper* startup_helper_; // Owned by ash::Shell.
DISALLOW_COPY_AND_ASSIGN(WindowTreeHostManagerStartupTest);
};
......@@ -401,7 +361,10 @@ TEST_F(WindowTreeHostManagerShutdownTest, Shutdown) {
}
TEST_F(WindowTreeHostManagerStartupTest, Startup) {
EXPECT_TRUE(startup_helper()->displays_initialized());
// Ensure that WindowTreeHostManager was initialized and created at least one
// root window.
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
EXPECT_FALSE(root_windows.empty());
}
TEST_F(WindowTreeHostManagerTest, SecondaryDisplayLayout) {
......
......@@ -1051,8 +1051,6 @@ void Shell::Init(
cursor_manager_ =
std::make_unique<CursorManager>(base::WrapUnique(native_cursor_manager_));
shell_delegate_->PreInit();
// In CLASSIC mode, |initial_display_prefs| contains the synchronously
// loaded display pref values. Otherwise |initial_display_prefs| is null and
// the pref values will be loaded once |local_state_| is available. (Any store
......
......@@ -21,8 +21,6 @@ bool ShellDelegateImpl::CanShowWindowForUser(aura::Window* window) const {
return true;
}
void ShellDelegateImpl::PreInit() {}
std::unique_ptr<keyboard::KeyboardUI> ShellDelegateImpl::CreateKeyboardUI() {
return std::make_unique<TestKeyboardUI>();
}
......
......@@ -25,7 +25,6 @@ class ShellDelegateImpl : public ShellDelegate {
// ShellDelegate:
bool CanShowWindowForUser(aura::Window* window) const override;
void PreInit() override;
std::unique_ptr<keyboard::KeyboardUI> CreateKeyboardUI() override;
std::unique_ptr<ScreenshotDelegate> CreateScreenshotDelegate() override;
AccessibilityDelegate* CreateAccessibilityDelegate() override;
......
......@@ -39,10 +39,6 @@ class ASH_EXPORT ShellDelegate {
// user.
virtual bool CanShowWindowForUser(aura::Window* window) const = 0;
// Called before processing |Shell::Init()| so that the delegate
// can perform tasks necessary before the shell is initialized.
virtual void PreInit() = 0;
// Create a shell-specific keyboard::KeyboardUI.
virtual std::unique_ptr<keyboard::KeyboardUI> CreateKeyboardUI() = 0;
......
......@@ -52,10 +52,6 @@ bool ShellDelegateMash::CanShowWindowForUser(aura::Window* window) const {
return true;
}
void ShellDelegateMash::PreInit() {
NOTIMPLEMENTED_LOG_ONCE();
}
std::unique_ptr<keyboard::KeyboardUI> ShellDelegateMash::CreateKeyboardUI() {
NOTIMPLEMENTED_LOG_ONCE();
return nullptr;
......
......@@ -19,7 +19,6 @@ class ShellDelegateMash : public ShellDelegate {
// ShellDelegate:
bool CanShowWindowForUser(aura::Window* window) const override;
void PreInit() override;
std::unique_ptr<keyboard::KeyboardUI> CreateKeyboardUI() override;
std::unique_ptr<ScreenshotDelegate> CreateScreenshotDelegate() override;
AccessibilityDelegate* CreateAccessibilityDelegate() override;
......
......@@ -21,8 +21,6 @@ bool TestShellDelegate::CanShowWindowForUser(aura::Window* window) const {
return true;
}
void TestShellDelegate::PreInit() {}
std::unique_ptr<keyboard::KeyboardUI> TestShellDelegate::CreateKeyboardUI() {
return std::make_unique<TestKeyboardUI>();
}
......
......@@ -19,7 +19,6 @@ class TestShellDelegate : public ShellDelegate {
// Overridden from ShellDelegate:
bool CanShowWindowForUser(aura::Window* window) const override;
void PreInit() override;
std::unique_ptr<keyboard::KeyboardUI> CreateKeyboardUI() override;
std::unique_ptr<ScreenshotDelegate> CreateScreenshotDelegate() override;
AccessibilityDelegate* CreateAccessibilityDelegate() override;
......
......@@ -92,8 +92,6 @@ bool ChromeShellDelegate::CanShowWindowForUser(aura::Window* window) const {
base::BindRepeating(&GetActiveBrowserContext));
}
void ChromeShellDelegate::PreInit() {}
void ChromeShellDelegate::OpenKeyboardShortcutHelpPage() const {
chrome::ScopedTabbedBrowserDisplayer scoped_tabbed_browser_displayer(
ProfileManager::GetActiveUserProfile());
......
......@@ -23,7 +23,6 @@ class ChromeShellDelegate : public ash::ShellDelegate {
// ash::ShellDelegate overrides;
bool CanShowWindowForUser(aura::Window* window) const override;
void PreInit() override;
std::unique_ptr<keyboard::KeyboardUI> CreateKeyboardUI() override;
std::unique_ptr<ash::ScreenshotDelegate> CreateScreenshotDelegate() override;
ash::AccessibilityDelegate* CreateAccessibilityDelegate() override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment