Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc

Issue 2969643002: Reland - Replace FakeServer's implementation with LoopbackServer invocations. (Closed)
Patch Set: Rebased on master. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/sync/test/integration/autofill_helper.h" 9 #include "chrome/browser/sync/test/integration/autofill_helper.h"
10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
11 #include "chrome/browser/sync/test/integration/single_client_status_change_check er.h" 11 #include "chrome/browser/sync/test/integration/single_client_status_change_check er.h"
12 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" 12 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
13 #include "chrome/browser/sync/test/integration/sync_test.h" 13 #include "chrome/browser/sync/test/integration/sync_test.h"
14 #include "chrome/browser/web_data_service_factory.h" 14 #include "chrome/browser/web_data_service_factory.h"
15 #include "components/autofill/core/browser/credit_card.h" 15 #include "components/autofill/core/browser/credit_card.h"
16 #include "components/autofill/core/browser/field_types.h" 16 #include "components/autofill/core/browser/field_types.h"
17 #include "components/autofill/core/browser/personal_data_manager.h" 17 #include "components/autofill/core/browser/personal_data_manager.h"
18 #include "components/autofill/core/common/autofill_pref_names.h" 18 #include "components/autofill/core/common/autofill_pref_names.h"
19 #include "components/browser_sync/profile_sync_service.h" 19 #include "components/browser_sync/profile_sync_service.h"
20 #include "components/prefs/pref_service.h" 20 #include "components/prefs/pref_service.h"
21 #include "components/sync/base/model_type.h" 21 #include "components/sync/base/model_type.h"
22 #include "components/sync/test/fake_server/fake_server_entity.h" 22 #include "components/sync/test/fake_server/fake_server.h"
23 #include "components/sync/test/fake_server/unique_client_entity.h"
24 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
25 24
26 using autofill_helper::GetPersonalDataManager; 25 using autofill_helper::GetPersonalDataManager;
27 26
28 namespace { 27 namespace {
29 28
30 const char kDefaultCardID[] = "wallet entity ID"; 29 const char kDefaultCardID[] = "wallet entity ID";
31 const int kDefaultCardExpMonth = 8; 30 const int kDefaultCardExpMonth = 8;
32 const int kDefaultCardExpYear = 2087; 31 const int kDefaultCardExpYear = 2087;
33 const char kDefaultCardLastFour[] = "1234"; 32 const char kDefaultCardLastFour[] = "1234";
(...skipping 11 matching lines...) Expand all
45 sync_pb::WalletMaskedCreditCard* credit_card = 44 sync_pb::WalletMaskedCreditCard* credit_card =
46 wallet_specifics->mutable_masked_card(); 45 wallet_specifics->mutable_masked_card();
47 credit_card->set_id(kDefaultCardID); 46 credit_card->set_id(kDefaultCardID);
48 credit_card->set_exp_month(kDefaultCardExpMonth); 47 credit_card->set_exp_month(kDefaultCardExpMonth);
49 credit_card->set_exp_year(kDefaultCardExpYear); 48 credit_card->set_exp_year(kDefaultCardExpYear);
50 credit_card->set_last_four(kDefaultCardLastFour); 49 credit_card->set_last_four(kDefaultCardLastFour);
51 credit_card->set_name_on_card(kDefaultCardName); 50 credit_card->set_name_on_card(kDefaultCardName);
52 credit_card->set_status(sync_pb::WalletMaskedCreditCard::VALID); 51 credit_card->set_status(sync_pb::WalletMaskedCreditCard::VALID);
53 credit_card->set_type(kDefaultCardType); 52 credit_card->set_type(kDefaultCardType);
54 53
55 server->InjectEntity(fake_server::UniqueClientEntity::CreateForInjection( 54 server->InjectEntity(
56 kDefaultCardID, 55 syncer::PersistentUniqueClientEntity::CreateFromEntitySpecifics(
57 specifics)); 56 kDefaultCardID, specifics));
58 } 57 }
59 58
60 } // namespace 59 } // namespace
61 60
62 class SingleClientWalletSyncTest : public SyncTest { 61 class SingleClientWalletSyncTest : public SyncTest {
63 public: 62 public:
64 SingleClientWalletSyncTest() : SyncTest(SINGLE_CLIENT) {} 63 SingleClientWalletSyncTest() : SyncTest(SINGLE_CLIENT) {}
65 ~SingleClientWalletSyncTest() override {} 64 ~SingleClientWalletSyncTest() override {}
66 65
67 private: 66 private:
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 std::vector<autofill::CreditCard*> cards = pdm->GetCreditCards(); 181 std::vector<autofill::CreditCard*> cards = pdm->GetCreditCards();
183 ASSERT_EQ(1uL, cards.size()); 182 ASSERT_EQ(1uL, cards.size());
184 183
185 // Turn off the wallet autofill pref, the card should be gone as a side 184 // Turn off the wallet autofill pref, the card should be gone as a side
186 // effect of the wallet data type controller noticing. 185 // effect of the wallet data type controller noticing.
187 GetProfile(0)->GetPrefs()->SetBoolean( 186 GetProfile(0)->GetPrefs()->SetBoolean(
188 autofill::prefs::kAutofillWalletImportEnabled, false); 187 autofill::prefs::kAutofillWalletImportEnabled, false);
189 cards = pdm->GetCreditCards(); 188 cards = pdm->GetCreditCards();
190 ASSERT_EQ(0uL, cards.size()); 189 ASSERT_EQ(0uL, cards.size());
191 } 190 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc ('k') | components/sync/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698