| 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 "components/autofill/core/browser/personal_data_manager.h" | 5 #include "components/autofill/core/browser/personal_data_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/feature_list.h" | 18 #include "base/feature_list.h" |
| 19 #include "base/files/scoped_temp_dir.h" | 19 #include "base/files/scoped_temp_dir.h" |
| 20 #include "base/guid.h" | 20 #include "base/guid.h" |
| 21 #include "base/memory/ptr_util.h" |
| 21 #include "base/metrics/field_trial.h" | 22 #include "base/metrics/field_trial.h" |
| 22 #include "base/run_loop.h" | 23 #include "base/run_loop.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/synchronization/waitable_event.h" | 25 #include "base/synchronization/waitable_event.h" |
| 25 #include "base/test/histogram_tester.h" | 26 #include "base/test/histogram_tester.h" |
| 26 #include "base/test/scoped_feature_list.h" | 27 #include "base/test/scoped_feature_list.h" |
| 27 #include "base/threading/thread_task_runner_handle.h" | 28 #include "base/threading/thread_task_runner_handle.h" |
| 28 #include "base/time/time.h" | 29 #include "base/time/time.h" |
| 29 #include "build/build_config.h" | 30 #include "build/build_config.h" |
| 30 #include "components/autofill/core/browser/autofill_experiments.h" | 31 #include "components/autofill/core/browser/autofill_experiments.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 302 } |
| 302 | 303 |
| 303 // Sets up the profile order field trial group and parameter. Sets up the | 304 // Sets up the profile order field trial group and parameter. Sets up the |
| 304 // suggestions limit parameter to |limit_param|. | 305 // suggestions limit parameter to |limit_param|. |
| 305 void EnableAutofillProfileLimitFieldTrial(const std::string& limit_param) { | 306 void EnableAutofillProfileLimitFieldTrial(const std::string& limit_param) { |
| 306 DCHECK(!limit_param.empty()); | 307 DCHECK(!limit_param.empty()); |
| 307 | 308 |
| 308 // Clear the existing |field_trial_list_| and variation parameters. | 309 // Clear the existing |field_trial_list_| and variation parameters. |
| 309 field_trial_list_.reset(NULL); | 310 field_trial_list_.reset(NULL); |
| 310 field_trial_list_.reset( | 311 field_trial_list_.reset( |
| 311 new base::FieldTrialList(new metrics::SHA1EntropyProvider("foo"))); | 312 new base::FieldTrialList( |
| 313 base::MakeUnique<metrics::SHA1EntropyProvider>("foo"))); |
| 312 variations::testing::ClearAllVariationParams(); | 314 variations::testing::ClearAllVariationParams(); |
| 313 | 315 |
| 314 std::map<std::string, std::string> params; | 316 std::map<std::string, std::string> params; |
| 315 params[kFrecencyFieldTrialLimitParam] = limit_param; | 317 params[kFrecencyFieldTrialLimitParam] = limit_param; |
| 316 variations::AssociateVariationParams(kFrecencyFieldTrialName, "LimitToN", | 318 variations::AssociateVariationParams(kFrecencyFieldTrialName, "LimitToN", |
| 317 params); | 319 params); |
| 318 | 320 |
| 319 field_trial_ = base::FieldTrialList::CreateFieldTrial( | 321 field_trial_ = base::FieldTrialList::CreateFieldTrial( |
| 320 kFrecencyFieldTrialName, "LimitToN"); | 322 kFrecencyFieldTrialName, "LimitToN"); |
| 321 field_trial_->group(); | 323 field_trial_->group(); |
| (...skipping 5019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5341 EnableAutofillProfileCleanup(); | 5343 EnableAutofillProfileCleanup(); |
| 5342 | 5344 |
| 5343 // The deduping routine should not be run. | 5345 // The deduping routine should not be run. |
| 5344 EXPECT_FALSE(personal_data_->ApplyDedupingRoutine()); | 5346 EXPECT_FALSE(personal_data_->ApplyDedupingRoutine()); |
| 5345 | 5347 |
| 5346 // The two duplicate profiles should still be present. | 5348 // The two duplicate profiles should still be present. |
| 5347 EXPECT_EQ(2U, personal_data_->GetProfiles().size()); | 5349 EXPECT_EQ(2U, personal_data_->GetProfiles().size()); |
| 5348 } | 5350 } |
| 5349 | 5351 |
| 5350 } // namespace autofill | 5352 } // namespace autofill |
| OLD | NEW |