OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.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/metrics/field_trial.h" | 15 #include "base/metrics/field_trial.h" |
16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
19 #include "base/thread_task_runner_handle.h" | 19 #include "base/thread_task_runner_handle.h" |
20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
22 #include "components/autofill/core/browser/autofill_experiments.h" | 22 #include "components/autofill/core/browser/autofill_experiments.h" |
23 #include "components/autofill/core/browser/autofill_profile.h" | 23 #include "components/autofill/core/browser/autofill_profile.h" |
24 #include "components/autofill/core/browser/autofill_test_utils.h" | 24 #include "components/autofill/core/browser/autofill_test_utils.h" |
25 #include "components/autofill/core/browser/country_names.h" | |
25 #include "components/autofill/core/browser/field_types.h" | 26 #include "components/autofill/core/browser/field_types.h" |
26 #include "components/autofill/core/browser/form_structure.h" | 27 #include "components/autofill/core/browser/form_structure.h" |
27 #include "components/autofill/core/browser/personal_data_manager.h" | 28 #include "components/autofill/core/browser/personal_data_manager.h" |
28 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 29 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
29 #include "components/autofill/core/browser/webdata/autofill_table.h" | 30 #include "components/autofill/core/browser/webdata/autofill_table.h" |
30 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 31 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
31 #include "components/autofill/core/common/autofill_pref_names.h" | 32 #include "components/autofill/core/common/autofill_pref_names.h" |
32 #include "components/autofill/core/common/autofill_switches.h" | 33 #include "components/autofill/core/common/autofill_switches.h" |
33 #include "components/autofill/core/common/form_data.h" | 34 #include "components/autofill/core/common/form_data.h" |
34 #include "components/signin/core/browser/account_tracker_service.h" | 35 #include "components/signin/core/browser/account_tracker_service.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 results_copy.end(), | 92 results_copy.end(), |
92 expectations_copy.begin(), | 93 expectations_copy.begin(), |
93 ElementsEqual<T>).first, | 94 ElementsEqual<T>).first, |
94 results_copy.end()); | 95 results_copy.end()); |
95 } | 96 } |
96 | 97 |
97 } // anonymous namespace | 98 } // anonymous namespace |
98 | 99 |
99 class PersonalDataManagerTest : public testing::Test { | 100 class PersonalDataManagerTest : public testing::Test { |
100 protected: | 101 protected: |
101 PersonalDataManagerTest() : autofill_table_(nullptr) {} | 102 PersonalDataManagerTest() : autofill_table_(nullptr) { |
103 CountryNames::SetLocaleString("en-US"); | |
Ilya Sherman
2016/01/23 01:41:04
Hmm, why is this needed, given that the PDM sets t
vabr (Chromium)
2016/01/25 10:36:44
Good point, I forgot this here when I modified PDM
| |
104 } | |
102 | 105 |
103 void SetUp() override { | 106 void SetUp() override { |
104 prefs_ = test::PrefServiceForTesting(); | 107 prefs_ = test::PrefServiceForTesting(); |
105 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 108 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
106 base::FilePath path = temp_dir_.path().AppendASCII("TestWebDB"); | 109 base::FilePath path = temp_dir_.path().AppendASCII("TestWebDB"); |
107 web_database_ = | 110 web_database_ = |
108 new WebDatabaseService(path, base::ThreadTaskRunnerHandle::Get(), | 111 new WebDatabaseService(path, base::ThreadTaskRunnerHandle::Get(), |
109 base::ThreadTaskRunnerHandle::Get()); | 112 base::ThreadTaskRunnerHandle::Get()); |
110 | 113 |
111 // Setup account tracker. | 114 // Setup account tracker. |
(...skipping 3465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3577 | 3580 |
3578 ResetPersonalDataManager(USER_MODE_NORMAL); | 3581 ResetPersonalDataManager(USER_MODE_NORMAL); |
3579 | 3582 |
3580 std::vector<Suggestion> suggestions = personal_data_->GetProfileSuggestions( | 3583 std::vector<Suggestion> suggestions = personal_data_->GetProfileSuggestions( |
3581 AutofillType(NAME_FIRST), base::string16(), false, | 3584 AutofillType(NAME_FIRST), base::string16(), false, |
3582 std::vector<ServerFieldType>()); | 3585 std::vector<ServerFieldType>()); |
3583 EXPECT_EQ(2U, suggestions.size()); | 3586 EXPECT_EQ(2U, suggestions.size()); |
3584 } | 3587 } |
3585 | 3588 |
3586 } // namespace autofill | 3589 } // namespace autofill |
OLD | NEW |