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

Side by Side Diff: chrome/browser/autofill/autofill_manager_unittest.cc

Issue 6260001: Cleanup: Remove unneeded chrome/browser/ui/browser.h usage.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/browser_about_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <vector> 5 #include <vector>
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/ref_counted.h" 8 #include "base/ref_counted.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/scoped_vector.h" 10 #include "base/scoped_vector.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/tuple.h" 14 #include "base/tuple.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/autocomplete_history_manager.h" 16 #include "chrome/browser/autocomplete_history_manager.h"
17 #include "chrome/browser/autofill/autofill_common_test.h" 17 #include "chrome/browser/autofill/autofill_common_test.h"
18 #include "chrome/browser/autofill/autofill_manager.h" 18 #include "chrome/browser/autofill/autofill_manager.h"
19 #include "chrome/browser/autofill/autofill_profile.h" 19 #include "chrome/browser/autofill/autofill_profile.h"
20 #include "chrome/browser/autofill/credit_card.h" 20 #include "chrome/browser/autofill/credit_card.h"
21 #include "chrome/browser/autofill/personal_data_manager.h" 21 #include "chrome/browser/autofill/personal_data_manager.h"
22 #include "chrome/browser/prefs/pref_service.h" 22 #include "chrome/browser/prefs/pref_service.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/renderer_host/test/test_render_view_host.h" 24 #include "chrome/browser/renderer_host/test/test_render_view_host.h"
25 #include "chrome/browser/tab_contents/test_tab_contents.h" 25 #include "chrome/browser/tab_contents/test_tab_contents.h"
26 #include "chrome/browser/ui/browser.h"
26 #include "chrome/common/ipc_test_sink.h" 27 #include "chrome/common/ipc_test_sink.h"
27 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
28 #include "chrome/common/render_messages.h" 29 #include "chrome/common/render_messages.h"
29 #include "chrome/test/testing_profile.h" 30 #include "chrome/test/testing_profile.h"
30 #include "googleurl/src/gurl.h" 31 #include "googleurl/src/gurl.h"
31 #include "grit/generated_resources.h" 32 #include "grit/generated_resources.h"
32 #include "testing/gtest/include/gtest/gtest.h" 33 #include "testing/gtest/include/gtest/gtest.h"
33 #include "webkit/glue/form_data.h" 34 #include "webkit/glue/form_data.h"
34 #include "webkit/glue/form_field.h" 35 #include "webkit/glue/form_field.h"
35 36
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 profile = new AutoFillProfile; 111 profile = new AutoFillProfile;
111 autofill_test::SetProfileInfo(profile, "Empty", "", "", "", "", "", "", "", 112 autofill_test::SetProfileInfo(profile, "Empty", "", "", "", "", "", "", "",
112 "", "", "", "", "", ""); 113 "", "", "", "", "", "");
113 profile->set_guid("00000000-0000-0000-0000-000000000003"); 114 profile->set_guid("00000000-0000-0000-0000-000000000003");
114 profiles->push_back(profile); 115 profiles->push_back(profile);
115 } 116 }
116 117
117 void CreateTestCreditCards(ScopedVector<CreditCard>* credit_cards) { 118 void CreateTestCreditCards(ScopedVector<CreditCard>* credit_cards) {
118 CreditCard* credit_card = new CreditCard; 119 CreditCard* credit_card = new CreditCard;
119 autofill_test::SetCreditCardInfo(credit_card, "First", "Elvis Presley", 120 autofill_test::SetCreditCardInfo(credit_card, "First", "Elvis Presley",
120 "4234567890123456", // Visa 121 "4234567890123456", // Visa
121 "04", "2012"); 122 "04", "2012");
122 credit_card->set_guid("00000000-0000-0000-0000-000000000004"); 123 credit_card->set_guid("00000000-0000-0000-0000-000000000004");
123 credit_cards->push_back(credit_card); 124 credit_cards->push_back(credit_card);
124 credit_card = new CreditCard; 125 credit_card = new CreditCard;
125 autofill_test::SetCreditCardInfo(credit_card, "Second", "Buddy Holly", 126 autofill_test::SetCreditCardInfo(credit_card, "Second", "Buddy Holly",
126 "5187654321098765", // Mastercard 127 "5187654321098765", // Mastercard
127 "10", "2014"); 128 "10", "2014");
128 credit_card->set_guid("00000000-0000-0000-0000-000000000005"); 129 credit_card->set_guid("00000000-0000-0000-0000-000000000005");
129 credit_cards->push_back(credit_card); 130 credit_cards->push_back(credit_card);
130 credit_card = new CreditCard; 131 credit_card = new CreditCard;
131 autofill_test::SetCreditCardInfo(credit_card, "Empty", "", "", "", ""); 132 autofill_test::SetCreditCardInfo(credit_card, "Empty", "", "", "", "");
132 credit_card->set_guid("00000000-0000-0000-0000-000000000006"); 133 credit_card->set_guid("00000000-0000-0000-0000-000000000006");
133 credit_cards->push_back(credit_card); 134 credit_cards->push_back(credit_card);
134 } 135 }
135 136
136 DISALLOW_COPY_AND_ASSIGN(TestPersonalDataManager); 137 DISALLOW_COPY_AND_ASSIGN(TestPersonalDataManager);
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 EXPECT_TRUE(GetAutoFillFormDataFilledMessage(&page_id, &results)); 1380 EXPECT_TRUE(GetAutoFillFormDataFilledMessage(&page_id, &results));
1380 { 1381 {
1381 SCOPED_TRACE("Credit card 1"); 1382 SCOPED_TRACE("Credit card 1");
1382 ExpectFilledCreditCardFormElvis(page_id, results, kPageID2, true); 1383 ExpectFilledCreditCardFormElvis(page_id, results, kPageID2, true);
1383 } 1384 }
1384 1385
1385 // Now set the credit card fields to also be auto-filled, and try again to 1386 // Now set the credit card fields to also be auto-filled, and try again to
1386 // fill the credit card data 1387 // fill the credit card data
1387 for (std::vector<FormField>::iterator iter = form.fields.begin(); 1388 for (std::vector<FormField>::iterator iter = form.fields.begin();
1388 iter != form.fields.end(); 1389 iter != form.fields.end();
1389 ++iter){ 1390 ++iter) {
1390 iter->set_autofilled(true); 1391 iter->set_autofilled(true);
1391 } 1392 }
1392 1393
1393 const int kPageID3 = 3; 1394 const int kPageID3 = 3;
1394 FillAutoFillFormData( 1395 FillAutoFillFormData(
1395 kPageID3, form, *form.fields.rbegin(), 1396 kPageID3, form, *form.fields.rbegin(),
1396 autofill_manager_->PackGUIDs(guid, std::string())); 1397 autofill_manager_->PackGUIDs(guid, std::string()));
1397 1398
1398 page_id = 0; 1399 page_id = 0;
1399 EXPECT_TRUE(GetAutoFillFormDataFilledMessage(&page_id, &results)); 1400 EXPECT_TRUE(GetAutoFillFormDataFilledMessage(&page_id, &results));
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 #else 1579 #else
1579 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( 1580 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean(
1580 prefs::kAutoFillAuxiliaryProfilesEnabled)); 1581 prefs::kAutoFillAuxiliaryProfilesEnabled));
1581 profile()->GetPrefs()->SetBoolean( 1582 profile()->GetPrefs()->SetBoolean(
1582 prefs::kAutoFillAuxiliaryProfilesEnabled, true); 1583 prefs::kAutoFillAuxiliaryProfilesEnabled, true);
1583 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled); 1584 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled);
1584 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( 1585 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean(
1585 prefs::kAutoFillAuxiliaryProfilesEnabled)); 1586 prefs::kAutoFillAuxiliaryProfilesEnabled));
1586 #endif 1587 #endif
1587 } 1588 }
1588
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_about_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698