OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 5 #include <map> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/guid.h" | 13 #include "base/guid.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
17 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/string_piece.h" | 19 #include "base/strings/string_piece.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 21 #include "chrome/browser/signin/account_tracker_service_factory.h" |
21 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 22 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
22 #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h" | 23 #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h" |
23 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 24 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
24 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" | 25 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" |
25 #include "chrome/browser/ui/autofill/mock_address_validator.h" | 26 #include "chrome/browser/ui/autofill/mock_address_validator.h" |
26 #include "chrome/browser/ui/autofill/mock_new_credit_card_bubble_controller.h" | 27 #include "chrome/browser/ui/autofill/mock_new_credit_card_bubble_controller.h" |
27 #include "chrome/browser/ui/autofill/test_generated_credit_card_bubble_controlle
r.h" | 28 #include "chrome/browser/ui/autofill/test_generated_credit_card_bubble_controlle
r.h" |
28 #include "chrome/browser/webdata/web_data_service_factory.h" | 29 #include "chrome/browser/webdata/web_data_service_factory.h" |
29 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
30 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
(...skipping 10 matching lines...) Expand all Loading... |
41 #include "components/autofill/content/browser/wallet/mock_wallet_client.h" | 42 #include "components/autofill/content/browser/wallet/mock_wallet_client.h" |
42 #include "components/autofill/content/browser/wallet/wallet_address.h" | 43 #include "components/autofill/content/browser/wallet/wallet_address.h" |
43 #include "components/autofill/content/browser/wallet/wallet_service_url.h" | 44 #include "components/autofill/content/browser/wallet/wallet_service_url.h" |
44 #include "components/autofill/content/browser/wallet/wallet_test_util.h" | 45 #include "components/autofill/content/browser/wallet/wallet_test_util.h" |
45 #include "components/autofill/core/browser/autofill_metrics.h" | 46 #include "components/autofill/core/browser/autofill_metrics.h" |
46 #include "components/autofill/core/browser/autofill_test_utils.h" | 47 #include "components/autofill/core/browser/autofill_test_utils.h" |
47 #include "components/autofill/core/browser/test_personal_data_manager.h" | 48 #include "components/autofill/core/browser/test_personal_data_manager.h" |
48 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 49 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
49 #include "components/autofill/core/common/autofill_switches.h" | 50 #include "components/autofill/core/common/autofill_switches.h" |
50 #include "components/autofill/core/common/form_data.h" | 51 #include "components/autofill/core/common/form_data.h" |
| 52 #include "components/signin/core/browser/account_tracker_service.h" |
51 #include "components/user_prefs/user_prefs.h" | 53 #include "components/user_prefs/user_prefs.h" |
52 #include "content/public/browser/web_contents.h" | 54 #include "content/public/browser/web_contents.h" |
53 #include "content/public/test/mock_render_process_host.h" | 55 #include "content/public/test/mock_render_process_host.h" |
54 #include "google_apis/gaia/google_service_auth_error.h" | 56 #include "google_apis/gaia/google_service_auth_error.h" |
55 #include "grit/components_scaled_resources.h" | 57 #include "grit/components_scaled_resources.h" |
56 #include "grit/components_strings.h" | 58 #include "grit/components_strings.h" |
57 #include "testing/gmock/include/gmock/gmock.h" | 59 #include "testing/gmock/include/gmock/gmock.h" |
58 #include "testing/gtest/include/gtest/gtest.h" | 60 #include "testing/gtest/include/gtest/gtest.h" |
59 #include "third_party/libaddressinput/chromium/chrome_address_validator.h" | 61 #include "third_party/libaddressinput/chromium/chrome_address_validator.h" |
60 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fi
eld.h" | 62 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_fi
eld.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 mock_new_card_bubble_controller_(mock_new_card_bubble_controller), | 262 mock_new_card_bubble_controller_(mock_new_card_bubble_controller), |
261 submit_button_delay_count_(0) {} | 263 submit_button_delay_count_(0) {} |
262 | 264 |
263 virtual ~TestAutofillDialogController() {} | 265 virtual ~TestAutofillDialogController() {} |
264 | 266 |
265 virtual AutofillDialogView* CreateView() override { | 267 virtual AutofillDialogView* CreateView() override { |
266 return new testing::NiceMock<TestAutofillDialogView>(); | 268 return new testing::NiceMock<TestAutofillDialogView>(); |
267 } | 269 } |
268 | 270 |
269 void Init(content::BrowserContext* browser_context) { | 271 void Init(content::BrowserContext* browser_context) { |
| 272 Profile* profile = Profile::FromBrowserContext(browser_context); |
270 test_manager_.Init(WebDataServiceFactory::GetAutofillWebDataForProfile( | 273 test_manager_.Init(WebDataServiceFactory::GetAutofillWebDataForProfile( |
271 Profile::FromBrowserContext(browser_context), | 274 profile, |
272 ServiceAccessType::EXPLICIT_ACCESS), | 275 ServiceAccessType::EXPLICIT_ACCESS), |
273 user_prefs::UserPrefs::Get(browser_context), | 276 user_prefs::UserPrefs::Get(browser_context), |
| 277 AccountTrackerServiceFactory::GetForProfile(profile), |
274 browser_context->IsOffTheRecord()); | 278 browser_context->IsOffTheRecord()); |
275 } | 279 } |
276 | 280 |
277 TestAutofillDialogView* GetView() { | 281 TestAutofillDialogView* GetView() { |
278 return static_cast<TestAutofillDialogView*>(view()); | 282 return static_cast<TestAutofillDialogView*>(view()); |
279 } | 283 } |
280 | 284 |
281 TestPersonalDataManager* GetTestingManager() { | 285 TestPersonalDataManager* GetTestingManager() { |
282 return &test_manager_; | 286 return &test_manager_; |
283 } | 287 } |
(...skipping 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3637 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(2)->value); | 3641 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(2)->value); |
3638 EXPECT_EQ(ADDRESS_HOME_COUNTRY, | 3642 EXPECT_EQ(ADDRESS_HOME_COUNTRY, |
3639 form_structure()->field(3)->Type().GetStorableType()); | 3643 form_structure()->field(3)->Type().GetStorableType()); |
3640 EXPECT_EQ(ASCIIToUTF16("US"), form_structure()->field(3)->value); | 3644 EXPECT_EQ(ASCIIToUTF16("US"), form_structure()->field(3)->value); |
3641 EXPECT_EQ(ADDRESS_HOME_COUNTRY, | 3645 EXPECT_EQ(ADDRESS_HOME_COUNTRY, |
3642 form_structure()->field(4)->Type().GetStorableType()); | 3646 form_structure()->field(4)->Type().GetStorableType()); |
3643 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(4)->value); | 3647 EXPECT_EQ(ASCIIToUTF16("United States"), form_structure()->field(4)->value); |
3644 } | 3648 } |
3645 | 3649 |
3646 } // namespace autofill | 3650 } // namespace autofill |
OLD | NEW |