Skip to content

Commit

Permalink
ShellExtensionLoaderTest should use existing PrefService
Browse files Browse the repository at this point in the history
ShellExtensionLoaderTest associates a new TestingPrefServiceSimple with
the BrowserContext, but instead should associate the existing
PrefService created by ExtensionsTest.

Creating its own TestingPrefServiceSimple, besides being unnecessary,
leads to invalid casts of its PrefRegistrySimple to a
PrefRegistrySyncable (breaking the Linux CFI bots).

TBR=rdevlin.cronin@chromium.org

Bug: 820647
Change-Id: I2ae62a396622d034c8c5b04bbe9dabb529b5bd25
Reviewed-on: https://chromium-review.googlesource.com/957871
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542302}
  • Loading branch information
michaelpg authored and Commit Bot committed Mar 10, 2018
1 parent cbbf6d7 commit 242098c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extensions/shell/browser/shell_extension_loader_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "base/path_service.h"
#include "components/crx_file/id_util.h"
#include "components/keep_alive_registry/keep_alive_registry.h"
#include "components/prefs/testing_pref_service.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/browser_context.h"
#include "content/public/test/test_utils.h"
Expand Down Expand Up @@ -95,7 +94,9 @@ class ShellExtensionLoaderTest : public ExtensionsTest {

ExtensionsTest::SetUp();
extensions_browser_client()->set_extension_system_factory(&factory_);
user_prefs::UserPrefs::Set(browser_context(), &testing_pref_service_);
// ExtensionsTest sets up the ExtensionPrefs, but we still need to attach
// the PrefService to the browser context.
user_prefs::UserPrefs::Set(browser_context(), pref_service());
event_router_ = CreateAndUseTestEventRouter(browser_context());
}

Expand Down Expand Up @@ -135,7 +136,6 @@ class ShellExtensionLoaderTest : public ExtensionsTest {

private:
MockExtensionSystemFactory<TestExtensionSystem> factory_;
TestingPrefServiceSimple testing_pref_service_;

TestEventRouter* event_router_ = nullptr; // Created in SetUp().

Expand Down

0 comments on commit 242098c

Please sign in to comment.