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

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

Issue 2798963003: Use ScopedTaskEnvironment instead of MessageLoop in components unit tests. (Closed)
Patch Set: Created 3 years, 8 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/autofill_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 10 matching lines...) Expand all
21 #include "base/metrics/field_trial.h" 21 #include "base/metrics/field_trial.h"
22 #include "base/metrics/metrics_hashes.h" 22 #include "base/metrics/metrics_hashes.h"
23 #include "base/run_loop.h" 23 #include "base/run_loop.h"
24 #include "base/strings/string16.h" 24 #include "base/strings/string16.h"
25 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
26 #include "base/strings/string_util.h" 26 #include "base/strings/string_util.h"
27 #include "base/strings/stringprintf.h" 27 #include "base/strings/stringprintf.h"
28 #include "base/strings/utf_string_conversions.h" 28 #include "base/strings/utf_string_conversions.h"
29 #include "base/test/histogram_tester.h" 29 #include "base/test/histogram_tester.h"
30 #include "base/test/scoped_feature_list.h" 30 #include "base/test/scoped_feature_list.h"
31 #include "base/test/scoped_task_environment.h"
31 #include "base/threading/thread_task_runner_handle.h" 32 #include "base/threading/thread_task_runner_handle.h"
32 #include "base/time/time.h" 33 #include "base/time/time.h"
33 #include "build/build_config.h" 34 #include "build/build_config.h"
34 #include "components/autofill/core/browser/autocomplete_history_manager.h" 35 #include "components/autofill/core/browser/autocomplete_history_manager.h"
35 #include "components/autofill/core/browser/autofill_download_manager.h" 36 #include "components/autofill/core/browser/autofill_download_manager.h"
36 #include "components/autofill/core/browser/autofill_experiments.h" 37 #include "components/autofill/core/browser/autofill_experiments.h"
37 #include "components/autofill/core/browser/autofill_profile.h" 38 #include "components/autofill/core/browser/autofill_profile.h"
38 #include "components/autofill/core/browser/autofill_test_utils.h" 39 #include "components/autofill/core/browser/autofill_test_utils.h"
39 #include "components/autofill/core/browser/credit_card.h" 40 #include "components/autofill/core/browser/credit_card.h"
40 #include "components/autofill/core/browser/personal_data_manager.h" 41 #include "components/autofill/core/browser/personal_data_manager.h"
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 FindMetric(metric_name, entry_proto.metrics()); 1101 FindMetric(metric_name, entry_proto.metrics());
1101 ASSERT_NE(nullptr, metric); 1102 ASSERT_NE(nullptr, metric);
1102 EXPECT_EQ(metric_value, metric->value()); 1103 EXPECT_EQ(metric_value, metric->value());
1103 ++num_matching_entries; 1104 ++num_matching_entries;
1104 } 1105 }
1105 } 1106 }
1106 EXPECT_EQ(expected_num_matching_entries, num_matching_entries); 1107 EXPECT_EQ(expected_num_matching_entries, num_matching_entries);
1107 } 1108 }
1108 1109
1109 protected: 1110 protected:
1110 base::MessageLoop message_loop_; 1111 base::test::ScopedTaskEnvironment scoped_task_environment_;
1111 MockAutofillClient autofill_client_; 1112 MockAutofillClient autofill_client_;
1112 std::unique_ptr<MockAutofillDriver> autofill_driver_; 1113 std::unique_ptr<MockAutofillDriver> autofill_driver_;
1113 std::unique_ptr<TestAutofillManager> autofill_manager_; 1114 std::unique_ptr<TestAutofillManager> autofill_manager_;
1114 std::unique_ptr<TestAutofillExternalDelegate> external_delegate_; 1115 std::unique_ptr<TestAutofillExternalDelegate> external_delegate_;
1115 scoped_refptr<net::TestURLRequestContextGetter> request_context_; 1116 scoped_refptr<net::TestURLRequestContextGetter> request_context_;
1116 TestPaymentsClient* payments_client_; 1117 TestPaymentsClient* payments_client_;
1117 TestAutofillDownloadManager* download_manager_; 1118 TestAutofillDownloadManager* download_manager_;
1118 TestPersonalDataManager personal_data_; 1119 TestPersonalDataManager personal_data_;
1119 base::FieldTrialList field_trial_list_; 1120 base::FieldTrialList field_trial_list_;
1120 base::test::ScopedFeatureList scoped_feature_list_; 1121 base::test::ScopedFeatureList scoped_feature_list_;
(...skipping 4771 matching lines...) Expand 10 before | Expand all | Expand 10 after
5892 FormsSeen({form}); 5893 FormsSeen({form});
5893 5894
5894 // Suggestions should be displayed. 5895 // Suggestions should be displayed.
5895 for (const FormFieldData& field : form.fields) { 5896 for (const FormFieldData& field : form.fields) {
5896 GetAutofillSuggestions(form, field); 5897 GetAutofillSuggestions(form, field);
5897 EXPECT_TRUE(external_delegate_->on_suggestions_returned_seen()); 5898 EXPECT_TRUE(external_delegate_->on_suggestions_returned_seen());
5898 } 5899 }
5899 } 5900 }
5900 5901
5901 } // namespace autofill 5902 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698