-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2041 from brave/uplift_pr1985
[0.62.x] Merge pull request #1985 from brave/enable_crash_report_on_dev_ni
- Loading branch information
Showing
6 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* Copyright (c) 2019 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* 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 "brave/browser/metrics/metrics_reporting_util.h" | ||
|
||
#include "base/logging.h" | ||
#include "chrome/common/channel_info.h" | ||
#include "components/version_info/channel.h" | ||
|
||
bool GetDefaultPrefValueForMetricsReporting() { | ||
switch (chrome::GetChannel()) { | ||
case version_info::Channel::STABLE: // fall through | ||
case version_info::Channel::BETA: | ||
return false; | ||
case version_info::Channel::DEV: // fall through | ||
case version_info::Channel::CANARY: | ||
return true; | ||
case version_info::Channel::UNKNOWN: | ||
return false; | ||
default: | ||
NOTREACHED(); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* Copyright (c) 2019 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* 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/. */ | ||
|
||
#ifndef BRAVE_BROWSER_METRICS_METRICS_REPORTING_UTIL_H_ | ||
#define BRAVE_BROWSER_METRICS_METRICS_REPORTING_UTIL_H_ | ||
|
||
bool GetDefaultPrefValueForMetricsReporting(); | ||
|
||
#endif // BRAVE_BROWSER_METRICS_METRICS_REPORTING_UTIL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* Copyright (c) 2019 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* 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 "brave/browser/metrics/metrics_reporting_util.h" | ||
|
||
#include "base/environment.h" | ||
#include "chrome/common/channel_info.h" | ||
#include "components/version_info/channel.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
TEST(MetricsUtilTest, DefaultValueTest) { | ||
#if defined(OFFICIAL_BUILD) | ||
auto env = base::Environment::Create(); | ||
|
||
env->SetVar("CHROME_VERSION_EXTRA", LINUX_CHANNEL_STABLE); | ||
EXPECT_EQ(version_info::Channel::STABLE, chrome::GetChannel()); | ||
EXPECT_FALSE(GetDefaultPrefValueForMetricsReporting()); | ||
|
||
env->SetVar("CHROME_VERSION_EXTRA", LINUX_CHANNEL_BETA); | ||
EXPECT_EQ(version_info::Channel::BETA, chrome::GetChannel()); | ||
EXPECT_FALSE(GetDefaultPrefValueForMetricsReporting()); | ||
|
||
env->SetVar("CHROME_VERSION_EXTRA", LINUX_CHANNEL_DEV); | ||
EXPECT_EQ(version_info::Channel::DEV, chrome::GetChannel()); | ||
EXPECT_TRUE(GetDefaultPrefValueForMetricsReporting()); | ||
|
||
env->SetVar("CHROME_VERSION_EXTRA", BRAVE_LINUX_CHANNEL_NIGHTLY); | ||
EXPECT_EQ(version_info::Channel::CANARY, chrome::GetChannel()); | ||
EXPECT_TRUE(GetDefaultPrefValueForMetricsReporting()); | ||
#else // OFFICIAL_BUILD | ||
EXPECT_EQ(version_info::Channel::UNKNOWN, chrome::GetChannel()); | ||
EXPECT_FALSE(GetDefaultPrefValueForMetricsReporting()); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters