Skip to content

Commit

Permalink
Use build guard for crash dialog code
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhong committed Sep 15, 2021
1 parent d37f2cc commit 25f4916
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions browser/brave_local_state_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "base/values.h"
#include "brave/browser/brave_stats/brave_stats_updater.h"
#include "brave/browser/metrics/buildflags/buildflags.h"
#include "brave/browser/metrics/metrics_reporting_util.h"
#include "brave/browser/themes/brave_dark_mode_utils.h"
#include "brave/common/pref_names.h"
Expand Down Expand Up @@ -98,6 +99,9 @@ void RegisterLocalStatePrefs(PrefRegistrySimple* registry) {
dark_mode::RegisterBraveDarkModeLocalStatePrefs(registry);

registry->RegisterBooleanPref(kDefaultBrowserPromptEnabled, true);
#endif

#if BUILDFLAG(ENABLE_CRASH_DIALOG)
registry->RegisterBooleanPref(kDontAskForCrashReporting, false);
#endif

Expand Down
8 changes: 6 additions & 2 deletions browser/brave_prefs_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "brave/browser/ethereum_remote_client/buildflags/buildflags.h"
#include "brave/browser/metrics/buildflags/buildflags.h"
#include "brave/common/pref_names.h"
#include "brave/components/brave_rewards/common/pref_names.h"
#include "brave/components/brave_shields/common/pref_names.h"
Expand Down Expand Up @@ -158,11 +159,14 @@ IN_PROC_BROWSER_TEST_F(BraveProfilePrefsBrowserTest,
prefs::kHideWebStoreIcon));
}

#if !defined(OS_ANDROID)
IN_PROC_BROWSER_TEST_F(BraveLocalStatePrefsBrowserTest, DefaultLocalStateTest) {
#if !defined(OS_ANDROID)
EXPECT_TRUE(g_browser_process->local_state()->GetBoolean(
kDefaultBrowserPromptEnabled));
#endif

#if BUILDFLAG(ENABLE_CRASH_DIALOG)
EXPECT_FALSE(
g_browser_process->local_state()->GetBoolean(kDontAskForCrashReporting));
}
#endif
}
2 changes: 2 additions & 0 deletions test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ if (!is_android) {
"//brave/browser/brave_wallet:tab_helper",
"//brave/browser/browsing_data:browser_tests",
"//brave/browser/farbling:browser_tests",
"//brave/browser/metrics/buildflags",
"//brave/browser/permissions:browser_tests",
"//brave/browser/tor:browser_tests",
"//brave/browser/ui:browser_tests",
Expand Down Expand Up @@ -970,6 +971,7 @@ if (!is_android) {
"//brave/app/theme:brave_unscaled_resources_grit",
"//brave/browser/brave_ads",
"//brave/browser/ethereum_remote_client/buildflags",
"//brave/browser/metrics/buildflags",
"//brave/browser/net",
"//brave/browser/themes",
"//brave/common:pref_names",
Expand Down

0 comments on commit 25f4916

Please sign in to comment.