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