Commit d37c909e authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Provide no-op impls of some functions in base classes.

This allows tests that want to provide mock implementations of these objects to
just override what's necessary to change functional behavior, not provide
boilerplate simply to instantiate the objects at all.

BUG=none
TEST=none

Change-Id: I0b3ccc6da2ae2b3a87789c06d427cae227a2d662
Reviewed-on: https://chromium-review.googlesource.com/987326
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547915}
parent 41d0f7d9
......@@ -39,6 +39,12 @@ void ChromeOmniboxEditController::OnInputInProgress(bool in_progress) {
UpdateWithoutTabRestore();
}
content::WebContents* ChromeOmniboxEditController::GetWebContents() {
return nullptr;
}
void ChromeOmniboxEditController::UpdateWithoutTabRestore() {}
ChromeOmniboxEditController::ChromeOmniboxEditController(
CommandUpdater* command_updater)
: command_updater_(command_updater) {}
......
......@@ -25,11 +25,11 @@ class ChromeOmniboxEditController : public OmniboxEditController {
void OnInputInProgress(bool in_progress) override;
// Returns the WebContents of the currently active tab.
virtual content::WebContents* GetWebContents() = 0;
virtual content::WebContents* GetWebContents();
// Called when the the controller should update itself without restoring any
// tab state.
virtual void UpdateWithoutTabRestore() = 0;
virtual void UpdateWithoutTabRestore();
CommandUpdater* command_updater() { return command_updater_; }
const CommandUpdater* command_updater() const { return command_updater_; }
......
......@@ -163,13 +163,10 @@ class TestingOmniboxEditController : public ChromeOmniboxEditController {
private:
// ChromeOmniboxEditController:
void UpdateWithoutTabRestore() override {}
void OnChanged() override {}
ToolbarModel* GetToolbarModel() override { return toolbar_model_; }
const ToolbarModel* GetToolbarModel() const override {
return toolbar_model_;
}
content::WebContents* GetWebContents() override { return nullptr; }
ToolbarModel* toolbar_model_;
......
......@@ -16,6 +16,10 @@ void OmniboxEditController::OnAutocompleteAccept(
transition_ = transition;
}
void OmniboxEditController::OnInputInProgress(bool in_progress) {}
void OmniboxEditController::OnChanged() {}
OmniboxEditController::OmniboxEditController()
: disposition_(WindowOpenDisposition::CURRENT_TAB),
transition_(ui::PageTransitionFromInt(
......
......@@ -20,12 +20,12 @@ class OmniboxEditController {
ui::PageTransition transition,
AutocompleteMatchType::Type match_type);
virtual void OnInputInProgress(bool in_progress) = 0;
virtual void OnInputInProgress(bool in_progress);
// Called when anything has changed that might affect the layout or contents
// of the views around the edit, including the text of the edit and the
// status of any keyword- or hint-related state.
virtual void OnChanged() = 0;
virtual void OnChanged();
virtual ToolbarModel* GetToolbarModel() = 0;
virtual const ToolbarModel* GetToolbarModel() const = 0;
......
......@@ -13,8 +13,6 @@ class TestOmniboxEditController : public OmniboxEditController {
TestOmniboxEditController() {}
// OmniboxEditController:
void OnInputInProgress(bool in_progress) override {}
void OnChanged() override {}
TestToolbarModel* GetToolbarModel() override;
const TestToolbarModel* GetToolbarModel() const 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