| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/permissions/permission_uma_util.h" | 5 #include "chrome/browser/permissions/permission_uma_util.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/test/scoped_command_line.h" | 9 #include "base/test/scoped_command_line.h" |
| 10 #include "chrome/browser/signin/fake_signin_manager_builder.h" | 10 #include "chrome/browser/signin/fake_signin_manager_builder.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 static bool IsOptedIntoPermissionActionReporting(Profile* profile) { | 38 static bool IsOptedIntoPermissionActionReporting(Profile* profile) { |
| 39 return PermissionUmaUtil::IsOptedIntoPermissionActionReporting(profile); | 39 return PermissionUmaUtil::IsOptedIntoPermissionActionReporting(profile); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void SetUp() override { | 42 void SetUp() override { |
| 43 TestingProfile::Builder builder; | 43 TestingProfile::Builder builder; |
| 44 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), | 44 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), |
| 45 BuildFakeSigninManagerBase); | 45 BuildFakeSigninManagerBase); |
| 46 profile_ = builder.Build(); | 46 profile_ = builder.Build(); |
| 47 PermissionUmaUtil::FakeOfficialBuildForTest(); |
| 47 } | 48 } |
| 48 | 49 |
| 49 void FakeSignIn() { | 50 void FakeSignIn() { |
| 50 SigninManagerBase* signin_manager = | 51 SigninManagerBase* signin_manager = |
| 51 static_cast<FakeSigninManagerForTesting*>( | 52 static_cast<FakeSigninManagerForTesting*>( |
| 52 SigninManagerFactory::GetForProfile(profile())); | 53 SigninManagerFactory::GetForProfile(profile())); |
| 53 signin_manager->SetAuthenticatedAccountInfo(kTestingGaiaId, | 54 signin_manager->SetAuthenticatedAccountInfo(kTestingGaiaId, |
| 54 kTestingUsername); | 55 kTestingUsername); |
| 55 } | 56 } |
| 56 | 57 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 IsOptedIntoPermissionActionReportingSyncPassphraseCheck) { | 208 IsOptedIntoPermissionActionReportingSyncPassphraseCheck) { |
| 208 SetSafeBrowsing(true); | 209 SetSafeBrowsing(true); |
| 209 FakeSignIn(); | 210 FakeSignIn(); |
| 210 ProfileSyncServiceMock* mock_sync_service = SetMockSyncService(); | 211 ProfileSyncServiceMock* mock_sync_service = SetMockSyncService(); |
| 211 EXPECT_TRUE(IsOptedIntoPermissionActionReporting(profile())); | 212 EXPECT_TRUE(IsOptedIntoPermissionActionReporting(profile())); |
| 212 | 213 |
| 213 EXPECT_CALL(*mock_sync_service, IsUsingSecondaryPassphrase()) | 214 EXPECT_CALL(*mock_sync_service, IsUsingSecondaryPassphrase()) |
| 214 .WillOnce(testing::Return(true)); | 215 .WillOnce(testing::Return(true)); |
| 215 EXPECT_FALSE(IsOptedIntoPermissionActionReporting(profile())); | 216 EXPECT_FALSE(IsOptedIntoPermissionActionReporting(profile())); |
| 216 } | 217 } |
| OLD | NEW |