Commit e59ccd94 authored by Dan Beam's avatar Dan Beam Committed by Commit Bot

Dark Mode / WebUI: make TestWebUI auto-register message handlers

This makes test code easier to write and understand and is also what the
"prod" WebUI class already does.

This is loosely related to Dark Mode support, as I discovered this
difference in behavior while working on unit tests for this work.

WIP Dark Mode CL: https://crrev.com/c/1354685

R=jam@chromium.org
BUG=883049

Change-Id: I6862e2cd0244bdb02bd6dd92870bc2ec70d2099a
Reviewed-on: https://chromium-review.googlesource.com/c/1359132Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Dan Beam <dbeam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613332}
parent 45b6eae1
......@@ -23,6 +23,7 @@ class ListValue;
namespace content {
class TestWebUI;
class WebUI;
class WebUIImpl;
......@@ -136,6 +137,7 @@ class CONTENT_EXPORT WebUIMessageHandler {
private:
// Provide external classes access to web_ui(), set_web_ui(), and
// RenderViewReused.
friend class TestWebUI;
friend class WebUIImpl;
friend class ::WebUIBrowserTest;
friend class ::MojoWebUIBrowserTest;
......
......@@ -70,6 +70,8 @@ void TestWebUI::SetBindings(int bindings) {
void TestWebUI::AddMessageHandler(
std::unique_ptr<WebUIMessageHandler> handler) {
handler->set_web_ui(this);
handler->RegisterMessages();
handlers_.push_back(std::move(handler));
}
......
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