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

Side by Side Diff: components/autofill/core/browser/form_structure_unittest.cc

Issue 2358723002: Convert FieldTrialList to Accept a std::unique_ptr (Closed)
Patch Set: Change Comment nullptr to null Created 4 years, 2 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
OLDNEW
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/form_structure.h" 5 #include "components/autofill/core/browser/form_structure.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/ptr_util.h"
12 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
13 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "components/autofill/core/browser/autofill_test_utils.h" 17 #include "components/autofill/core/browser/autofill_test_utils.h"
17 #include "components/autofill/core/common/autofill_switches.h" 18 #include "components/autofill/core/common/autofill_switches.h"
18 #include "components/autofill/core/common/form_data.h" 19 #include "components/autofill/core/common/form_data.h"
19 #include "components/autofill/core/common/form_field_data.h" 20 #include "components/autofill/core/common/form_field_data.h"
20 #include "components/variations/entropy_provider.h" 21 #include "components/variations/entropy_provider.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 61
61 protected: 62 protected:
62 void DisableAutofillMetadataFieldTrial() { 63 void DisableAutofillMetadataFieldTrial() {
63 field_trial_list_.reset(); 64 field_trial_list_.reset();
64 } 65 }
65 66
66 private: 67 private:
67 void EnableAutofillMetadataFieldTrial() { 68 void EnableAutofillMetadataFieldTrial() {
68 field_trial_list_.reset(); 69 field_trial_list_.reset();
69 field_trial_list_.reset( 70 field_trial_list_.reset(
70 new base::FieldTrialList(new metrics::SHA1EntropyProvider("foo"))); 71 new base::FieldTrialList(
72 base::MakeUnique<metrics::SHA1EntropyProvider>("foo")));
71 field_trial_ = base::FieldTrialList::CreateFieldTrial( 73 field_trial_ = base::FieldTrialList::CreateFieldTrial(
72 "AutofillFieldMetadata", "Enabled"); 74 "AutofillFieldMetadata", "Enabled");
73 field_trial_->group(); 75 field_trial_->group();
74 } 76 }
75 77
76 std::unique_ptr<base::FieldTrialList> field_trial_list_; 78 std::unique_ptr<base::FieldTrialList> field_trial_list_;
77 scoped_refptr<base::FieldTrial> field_trial_; 79 scoped_refptr<base::FieldTrial> field_trial_;
78 }; 80 };
79 81
80 TEST_F(FormStructureTest, FieldCount) { 82 TEST_F(FormStructureTest, FieldCount) {
(...skipping 3717 matching lines...) Expand 10 before | Expand all | Expand 10 after
3798 prefix = FormStructure::FindLongestCommonPrefix(strings); 3800 prefix = FormStructure::FindLongestCommonPrefix(strings);
3799 EXPECT_EQ(ASCIIToUTF16("1234567890123456"), prefix); 3801 EXPECT_EQ(ASCIIToUTF16("1234567890123456"), prefix);
3800 3802
3801 // Empty vector. 3803 // Empty vector.
3802 strings.clear(); 3804 strings.clear();
3803 prefix = FormStructure::FindLongestCommonPrefix(strings); 3805 prefix = FormStructure::FindLongestCommonPrefix(strings);
3804 EXPECT_EQ(ASCIIToUTF16(""), prefix); 3806 EXPECT_EQ(ASCIIToUTF16(""), prefix);
3805 } 3807 }
3806 3808
3807 } // namespace autofill 3809 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/win/chrome_elf_init_unittest.cc ('k') | components/autofill/core/browser/personal_data_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698