Skip to content

Commit

Permalink
Do not register TorClientUpdater in unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdh committed Oct 23, 2019
1 parent ab2bfcc commit f8dceb0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
6 changes: 4 additions & 2 deletions browser/extensions/brave_extension_management.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ namespace extensions {

BraveExtensionManagement::BraveExtensionManagement(Profile* profile)
: ExtensionManagement(profile),
extension_registry_observer_(this) {
extension_registry_observer_(this),
profile_(profile) {
extension_registry_observer_.Add(ExtensionRegistry::Get(
static_cast<content::BrowserContext*>(profile)));
providers_.push_back(
Expand All @@ -44,7 +45,8 @@ void BraveExtensionManagement::RegisterBraveExtensions() {
#if BUILDFLAG(ENABLE_TOR)
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
if (!command_line.HasSwitch(switches::kDisableTorClientUpdaterExtension))
if (!command_line.HasSwitch(switches::kDisableTorClientUpdaterExtension) &&
!profile_->AsTestingProfile())
g_brave_browser_process->tor_client_updater()->Register();
#endif
}
Expand Down
2 changes: 2 additions & 0 deletions browser/extensions/brave_extension_management.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class BraveExtensionManagement : public ExtensionManagement,
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
extension_registry_observer_;

Profile* profile_;

DISALLOW_COPY_AND_ASSIGN(BraveExtensionManagement);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "base/command_line.h"
#include "brave/common/brave_switches.h"
#define BRAVE_SET_UP \
base::CommandLine::ForCurrentProcess() \
->AppendSwitch(switches::kDisableTorClientUpdaterExtension);
#include "../../../../../../../chrome/browser/extensions/api/bookmarks/bookmarks_api_unittest.cc" // NOLINT

namespace extensions {
Expand Down

This file was deleted.

0 comments on commit f8dceb0

Please sign in to comment.