Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / components / autofill / core / browser / webdata / web_data_service_unittest.cc
index 383bd1b..803e25d 100644 (file)
@@ -348,9 +348,12 @@ TEST_F(WebDataServiceAutofillTest, ProfileRemove) {
 }
 
 TEST_F(WebDataServiceAutofillTest, ProfileUpdate) {
-  AutofillProfile profile1;
+  // The GUIDs are alphabetical for easier testing.
+  AutofillProfile profile1("087151C8-6AB1-487C-9095-28E80BE5DA15",
+                           "http://example.com");
   profile1.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Abe"));
-  AutofillProfile profile2;
+  AutofillProfile profile2("6141084B-72D7-4B73-90CF-3D6AC154673B",
+                           "http://example.com");
   profile2.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Alice"));
 
   EXPECT_CALL(observer_, AutofillProfileChanged(_))
@@ -371,16 +374,16 @@ TEST_F(WebDataServiceAutofillTest, ProfileUpdate) {
   EXPECT_EQ(profile2, *consumer.result()[1]);
   STLDeleteElements(&consumer.result());
 
-  AutofillProfile profile1_changed(profile1);
-  profile1_changed.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bill"));
+  AutofillProfile profile2_changed(profile2);
+  profile2_changed.SetRawInfo(NAME_FIRST, ASCIIToUTF16("Bill"));
   const AutofillProfileChange expected_change(
-      AutofillProfileChange::UPDATE, profile1.guid(), &profile1_changed);
+      AutofillProfileChange::UPDATE, profile2.guid(), &profile2_changed);
 
   EXPECT_CALL(observer_, AutofillProfileChanged(expected_change))
       .WillOnce(SignalEvent(&done_event_));
 
   // Update the profile.
-  wds_->UpdateAutofillProfile(profile1_changed);
+  wds_->UpdateAutofillProfile(profile2_changed);
   done_event_.TimedWait(test_timeout_);
 
   // Check that the updates were made.
@@ -389,9 +392,9 @@ TEST_F(WebDataServiceAutofillTest, ProfileUpdate) {
   base::MessageLoop::current()->Run();
   EXPECT_EQ(handle2, consumer2.handle());
   ASSERT_EQ(2U, consumer2.result().size());
-  EXPECT_NE(profile1, *consumer2.result()[0]);
-  EXPECT_EQ(profile1_changed, *consumer2.result()[0]);
-  EXPECT_EQ(profile2, *consumer2.result()[1]);
+  EXPECT_EQ(profile1, *consumer2.result()[0]);
+  EXPECT_EQ(profile2_changed, *consumer2.result()[1]);
+  EXPECT_NE(profile2, *consumer2.result()[1]);
   STLDeleteElements(&consumer2.result());
 }
 
@@ -439,9 +442,11 @@ TEST_F(WebDataServiceAutofillTest, CreditCardRemove) {
 }
 
 TEST_F(WebDataServiceAutofillTest, CreditUpdate) {
-  CreditCard card1;
+  CreditCard card1("B9C52112-BD5F-4080-84E1-C651D2CB90E2",
+                   "https://ejemplo.mx");
   card1.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Abe"));
-  CreditCard card2;
+  CreditCard card2("E4D2662E-5E16-44F3-AF5A-5A77FAE4A6F3",
+                   "https://example.com");
   card2.SetRawInfo(CREDIT_CARD_NAME, ASCIIToUTF16("Alice"));
 
   wds_->AddCreditCard(card1);