Commit 1d8b5c01 authored by Bret Sepulveda's avatar Bret Sepulveda Committed by Commit Bot

Fix TestWithBrowserView tests when ExtensionsToolbarMenu is enabled.

Unlike ToolbarActionsBar, ExtensionsToolbarContainer assumes the
ToolbarActionsModel always exists. When the feature flag was enabled,
this would crash any test that creates a BrowserView. To fix this,
TestWithBrowserView initializes ToolbarActionsModel.

Bug: 984654
Change-Id: I69df818c72f898dbf2e2bb7c80d3ac5bcc096c66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1901076Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Bret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715222}
parent 55752a3b
......@@ -11,6 +11,8 @@
#include "build/build_config.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
#include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h"
#include "chrome/browser/extensions/extension_action_test_util.h"
#include "chrome/browser/extensions/load_error_reporter.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/search_engines/chrome_template_url_service_client.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
......@@ -102,6 +104,10 @@ TestingProfile* TestWithBrowserView::CreateProfile() {
// location bar.
AutocompleteClassifierFactory::GetInstance()->SetTestingFactory(
profile, base::BindRepeating(&CreateAutocompleteClassifier));
// ToolbarActionsModel must exist before the toolbar initializes the
// extensions area.
extensions::LoadErrorReporter::Init(/* enable_noisy_errors */ false);
extensions::extension_action_test_util::CreateToolbarModelForProfile(profile);
// Configure the GaiaCookieManagerService to return no accounts.
signin::SetListAccountsResponseHttpNotFound(test_url_loader_factory());
......
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