Commit 56bcb45a authored by kcarattini's avatar kcarattini Committed by Commit bot

Turn on Permission Action Reporting by default.

BUG=613883

Review-Url: https://codereview.chromium.org/2269863002
Cr-Commit-Position: refs/heads/master@{#414627}
parent ad96d727
......@@ -555,9 +555,10 @@ void PermissionUmaUtil::PermissionPromptDeniedWithPersistenceToggle(
}
bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) {
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePermissionActionReporting))
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisablePermissionActionReporting)) {
return false;
}
DCHECK(profile);
if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE)
......@@ -568,7 +569,6 @@ bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) {
ProfileSyncService* profile_sync_service =
ProfileSyncServiceFactory::GetForProfile(profile);
// Do not report if profile can't get a profile sync service or sync cannot
// start.
if (!(profile_sync_service && profile_sync_service->CanSyncStart()))
......
......@@ -91,10 +91,7 @@ class PermissionUmaUtilTest : public testing::Test {
// true if Safe Browsing is enabled, Permission Action Reporting flag is
// enabled, not in incognito mode and signed in with default sync preferences.
TEST_F(PermissionUmaUtilTest, IsOptedIntoPermissionActionReportingSignInCheck) {
base::test::ScopedCommandLine scoped_command_line;
SetSafeBrowsing(true);
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kEnablePermissionActionReporting);
EXPECT_FALSE(IsOptedIntoPermissionActionReporting(profile()));
FakeSignIn();
......@@ -112,28 +109,26 @@ TEST_F(PermissionUmaUtilTest, IsOptedIntoPermissionActionReportingFlagCheck) {
SetSafeBrowsing(true);
FakeSignIn();
SetMockSyncService();
EXPECT_TRUE(IsOptedIntoPermissionActionReporting(profile()));
{
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kEnablePermissionActionReporting);
EXPECT_TRUE(IsOptedIntoPermissionActionReporting(profile()));
switches::kDisablePermissionActionReporting);
EXPECT_FALSE(IsOptedIntoPermissionActionReporting(profile()));
} // Reset the command line.
EXPECT_FALSE(IsOptedIntoPermissionActionReporting(profile()));
EXPECT_TRUE(IsOptedIntoPermissionActionReporting(profile()));
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kDisablePermissionActionReporting);
EXPECT_FALSE(IsOptedIntoPermissionActionReporting(profile()));
switches::kEnablePermissionActionReporting);
EXPECT_TRUE(IsOptedIntoPermissionActionReporting(profile()));
}
// Test that PermissionUmaUtil::IsOptedIntoPermissionActionReporting returns
// false if Safe Browsing is disabled.
TEST_F(PermissionUmaUtilTest,
IsOptedIntoPermissionActionReportingSafeBrowsingCheck) {
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kEnablePermissionActionReporting);
FakeSignIn();
SetMockSyncService();
SetSafeBrowsing(true);
......@@ -147,9 +142,6 @@ TEST_F(PermissionUmaUtilTest,
// false if Sync is disabled.
TEST_F(PermissionUmaUtilTest,
IsOptedIntoPermissionActionReportingProfileSyncServiceCheck) {
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kEnablePermissionActionReporting);
SetSafeBrowsing(true);
FakeSignIn();
ProfileSyncServiceMock* mock_sync_service = SetMockSyncService();
......@@ -164,9 +156,6 @@ TEST_F(PermissionUmaUtilTest,
// false if Tab Sync and Pref Sync are not both enabled.
TEST_F(PermissionUmaUtilTest,
IsOptedIntoPermissionActionReportingSyncPreferenceCheck) {
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kEnablePermissionActionReporting);
SetSafeBrowsing(true);
FakeSignIn();
ProfileSyncServiceMock* mock_sync_service = SetMockSyncService();
......@@ -198,9 +187,6 @@ TEST_F(PermissionUmaUtilTest,
// false if Sync is not active.
TEST_F(PermissionUmaUtilTest,
IsOptedIntoPermissionActionReportingProfileSyncServiceActiveCheck) {
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kEnablePermissionActionReporting);
SetSafeBrowsing(true);
FakeSignIn();
ProfileSyncServiceMock* mock_sync_service = SetMockSyncService();
......@@ -215,9 +201,6 @@ TEST_F(PermissionUmaUtilTest,
// false if a custom Sync passphrase is set.
TEST_F(PermissionUmaUtilTest,
IsOptedIntoPermissionActionReportingSyncPassphraseCheck) {
base::test::ScopedCommandLine scoped_command_line;
scoped_command_line.GetProcessCommandLine()->AppendSwitch(
switches::kEnablePermissionActionReporting);
SetSafeBrowsing(true);
FakeSignIn();
ProfileSyncServiceMock* mock_sync_service = SetMockSyncService();
......
......@@ -19,7 +19,6 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/website_settings/mock_permission_prompt_factory.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/safe_browsing/permission_report.pb.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
......@@ -52,11 +51,6 @@ class PermissionReporterBrowserTest : public SyncTest {
run_loop.Run();
}
void SetUpCommandLine(base::CommandLine* command_line) override {
SyncTest::SetUpCommandLine(command_line);
command_line->AppendSwitch(switches::kEnablePermissionActionReporting);
}
void AttachMockReportSenderOnIOThread(
scoped_refptr<SafeBrowsingService> safe_browsing_service) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
......
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