Commit c0cf53d4 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions Menu] Instantiate ToolbarActionsModel for CocoaProfileTests

The ExtensionsToolbarContainer relies on a non-null ToolbarActionsModel
to work (otherwise it segfaults). Thus, any test that creates a
BrowserView (or BrowserView-like) thing needs to instantiate a test
model.

Instantiate the model in the CocoaProfileTest suite. This puts it on
similar status with other keyed services instantiated in this test, such
as TemplateURLService and AutocompleteClassifier.

Bug: 984654

Change-Id: I61e348d175dc2b23ee912886a0be34b09c96d09c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2037839Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739078}
parent 3788e097
......@@ -10,6 +10,10 @@
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_action_test_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/load_error_reporter.h"
#include "chrome/browser/extensions/test_extension_system.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/chrome_signin_client_test_util.h"
......@@ -25,6 +29,7 @@
#include "components/signin/public/base/list_accounts_test_utils.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "content/public/test/browser_task_environment.h"
#include "extensions/browser/extension_system.h"
#include "ui/views/test/widget_test.h"
CocoaProfileTest::CocoaProfileTest()
......@@ -82,6 +87,15 @@ void CocoaProfileTest::SetUp() {
// Configure the GaiaCookieManagerService to return no accounts.
signin::SetListAccountsResponseHttpNotFound(&test_url_loader_factory_);
extensions::LoadErrorReporter::Init(false);
extensions::TestExtensionSystem* extension_system =
static_cast<extensions::TestExtensionSystem*>(
extensions::ExtensionSystem::Get(profile_));
extension_system->CreateExtensionService(
base::CommandLine::ForCurrentProcess(), base::FilePath(), false);
extensions::extension_action_test_util::CreateToolbarModelForProfile(
profile_);
profile_->CreateBookmarkModel(true);
bookmarks::test::WaitForBookmarkModelToLoad(
BookmarkModelFactory::GetForBrowserContext(profile_));
......
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