| Index: components/autofill/core/browser/options_util_unittest.cc
|
| diff --git a/components/autofill/core/browser/options_util_unittest.cc b/components/autofill/core/browser/options_util_unittest.cc
|
| index 0712dbeb472d8e06c550169e24753ddbad4e1721..f29c010676f2977697725068105cda34317c3c8b 100644
|
| --- a/components/autofill/core/browser/options_util_unittest.cc
|
| +++ b/components/autofill/core/browser/options_util_unittest.cc
|
| @@ -2,21 +2,11 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "components/autofill/core/browser/autofill_test_utils.h"
|
| #include "components/autofill/core/browser/options_util.h"
|
| -#include "components/autofill/core/browser/test_personal_data_manager.h"
|
| -#include "components/autofill/core/common/autofill_pref_names.h"
|
| -#include "components/prefs/pref_registry_simple.h"
|
| -#include "components/prefs/testing_pref_service.h"
|
| #include "components/sync_driver/data_type_manager.h"
|
| #include "components/sync_driver/fake_sync_service.h"
|
| #include "components/sync_driver/sync_service.h"
|
| -#include "google_apis/gaia/google_service_auth_error.h"
|
| -#include "sync/internal_api/public/engine/sync_status.h"
|
| -#include "sync/internal_api/public/sessions/sync_session_snapshot.h"
|
| -#include "testing/gmock/include/gmock/gmock.h"
|
| -
|
| -using testing::Return;
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace autofill {
|
|
|
| @@ -54,85 +44,32 @@ scoped_ptr<TestSyncService> CreateSyncService(bool has_autofill_profile,
|
| new TestSyncService(type_set, is_enabled_and_logged_in));
|
| }
|
|
|
| -scoped_ptr<TestingPrefServiceSimple> CreatePrefService(
|
| - bool autofill_wallet_import_enabled,
|
| - bool autofill_wallet_sync_experiment_enabled) {
|
| - scoped_ptr<TestingPrefServiceSimple> prefs(new TestingPrefServiceSimple());
|
| - prefs->registry()->RegisterBooleanPref(prefs::kAutofillEnabled, true);
|
| - prefs->registry()->RegisterBooleanPref(prefs::kAutofillWalletImportEnabled,
|
| - autofill_wallet_import_enabled);
|
| - prefs->registry()->RegisterBooleanPref(
|
| - prefs::kAutofillWalletSyncExperimentEnabled,
|
| - autofill_wallet_sync_experiment_enabled);
|
| -
|
| - return prefs;
|
| -}
|
| -
|
| -scoped_ptr<TestPersonalDataManager> CreatePersonalDataManager(
|
| - PrefService* prefs) {
|
| - scoped_ptr<TestPersonalDataManager> pdm(new TestPersonalDataManager());
|
| - pdm->SetTestingPrefService(prefs);
|
| - return pdm;
|
| -}
|
| -
|
| } // namespace
|
|
|
| // Verify that true is returned when all inputs are complete.
|
| TEST(WalletIntegrationAvailableTest, AllInputsComplete) {
|
| scoped_ptr<TestSyncService> sync = CreateSyncService(true, true);
|
| - scoped_ptr<TestingPrefServiceSimple> prefs = CreatePrefService(true, true);
|
| - scoped_ptr<TestPersonalDataManager> pdm =
|
| - CreatePersonalDataManager(prefs.get());
|
| -
|
| - EXPECT_TRUE(WalletIntegrationAvailable(sync.get(), *pdm));
|
| -}
|
| -
|
| -// Verify that true is returned even if wallet import is disabled. (Otherwise
|
| -// the user will never be able to enable it).
|
| -TEST(WalletIntegrationAvailableTest, WalletImportDisabled) {
|
| - scoped_ptr<TestSyncService> sync = CreateSyncService(true, true);
|
| - scoped_ptr<TestingPrefServiceSimple> prefs = CreatePrefService(false, true);
|
| - scoped_ptr<TestPersonalDataManager> pdm =
|
| - CreatePersonalDataManager(prefs.get());
|
|
|
| - EXPECT_TRUE(WalletIntegrationAvailable(sync.get(), *pdm));
|
| + EXPECT_TRUE(WalletIntegrationAvailable(sync.get()));
|
| }
|
|
|
| // Verify that false is returned when SyncService is missing or incomplete.
|
| TEST(WalletIntegrationAvailableTest, MissingOrIncompleteSyncService) {
|
| - // Setup |prefs| and |pdm| to do their part to make
|
| - // WalletIntegrationAvailable() return true.
|
| - scoped_ptr<TestingPrefServiceSimple> prefs = CreatePrefService(true, true);
|
| - scoped_ptr<TestPersonalDataManager> pdm =
|
| - CreatePersonalDataManager(prefs.get());
|
| -
|
| // Incomplete SyncService data should return false.
|
| - EXPECT_FALSE(WalletIntegrationAvailable(NULL, *pdm));
|
| + EXPECT_FALSE(WalletIntegrationAvailable(NULL));
|
|
|
| scoped_ptr<TestSyncService> sync = CreateSyncService(false, false);
|
| - EXPECT_FALSE(WalletIntegrationAvailable(sync.get(), *pdm));
|
| + EXPECT_FALSE(WalletIntegrationAvailable(sync.get()));
|
|
|
| sync = CreateSyncService(false, true);
|
| - EXPECT_FALSE(WalletIntegrationAvailable(sync.get(), *pdm));
|
| + EXPECT_FALSE(WalletIntegrationAvailable(sync.get()));
|
|
|
| sync = CreateSyncService(true, false);
|
| - EXPECT_FALSE(WalletIntegrationAvailable(sync.get(), *pdm));
|
| + EXPECT_FALSE(WalletIntegrationAvailable(sync.get()));
|
|
|
| // Complete SyncService data should return true.
|
| sync = CreateSyncService(true, true);
|
| - EXPECT_TRUE(WalletIntegrationAvailable(sync.get(), *pdm));
|
| -}
|
| -
|
| -// Verify that false is returned when
|
| -// !prefs::kAutofillWalletSyncExperimentEnabled.
|
| -TEST(WalletIntegrationAvailableTest, ExperimentalWalletIntegrationDisabled) {
|
| - scoped_ptr<TestSyncService> sync = CreateSyncService(true, true);
|
| - // Set kAutofillWalletSyncExperimentEnabled to false.
|
| - scoped_ptr<TestingPrefServiceSimple> prefs = CreatePrefService(true, false);
|
| - scoped_ptr<TestPersonalDataManager> pdm =
|
| - CreatePersonalDataManager(prefs.get());
|
| -
|
| - EXPECT_FALSE(WalletIntegrationAvailable(sync.get(), *pdm));
|
| + EXPECT_TRUE(WalletIntegrationAvailable(sync.get()));
|
| }
|
|
|
| } // namespace autofill
|
|
|