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

Side by Side Diff: components/omnibox/browser/history_quick_provider_performance_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/omnibox/browser/history_quick_provider.h" 5 #include "components/omnibox/browser/history_quick_provider.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <random> 8 #include <random>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/test/scoped_task_environment.h"
14 #include "components/history/core/browser/history_backend.h" 15 #include "components/history/core/browser/history_backend.h"
15 #include "components/history/core/browser/history_database.h" 16 #include "components/history/core/browser/history_database.h"
16 #include "components/history/core/browser/history_service.h" 17 #include "components/history/core/browser/history_service.h"
17 #include "components/history/core/test/history_service_test_util.h" 18 #include "components/history/core/test/history_service_test_util.h"
18 #include "components/omnibox/browser/fake_autocomplete_provider_client.h" 19 #include "components/omnibox/browser/fake_autocomplete_provider_client.h"
19 #include "components/omnibox/browser/history_test_util.h" 20 #include "components/omnibox/browser/history_test_util.h"
20 #include "components/omnibox/browser/in_memory_url_index_test_util.h" 21 #include "components/omnibox/browser/in_memory_url_index_test_util.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 #include "testing/perf/perf_test.h" 23 #include "testing/perf/perf_test.h"
23 24
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 void PrintMeasurements(const std::string& trace_name, 91 void PrintMeasurements(const std::string& trace_name,
91 const std::vector<base::TimeDelta>& measurements); 92 const std::vector<base::TimeDelta>& measurements);
92 93
93 history::HistoryBackend* history_backend() { 94 history::HistoryBackend* history_backend() {
94 return client_->GetHistoryService()->history_backend_.get(); 95 return client_->GetHistoryService()->history_backend_.get();
95 } 96 }
96 97
97 private: 98 private:
98 base::TimeDelta RunTest(const base::string16& text); 99 base::TimeDelta RunTest(const base::string16& text);
99 100
100 base::MessageLoop message_loop_; 101 base::test::ScopedTaskEnvironment scoped_task_environment_;
101 std::unique_ptr<FakeAutocompleteProviderClient> client_; 102 std::unique_ptr<FakeAutocompleteProviderClient> client_;
102 103
103 scoped_refptr<HistoryQuickProvider> provider_; 104 scoped_refptr<HistoryQuickProvider> provider_;
104 105
105 DISALLOW_COPY_AND_ASSIGN(HQPPerfTestOnePopularURL); 106 DISALLOW_COPY_AND_ASSIGN(HQPPerfTestOnePopularURL);
106 }; 107 };
107 108
108 void HQPPerfTestOnePopularURL::SetUp() { 109 void HQPPerfTestOnePopularURL::SetUp() {
109 if (base::ThreadTicks::IsSupported()) 110 if (base::ThreadTicks::IsSupported())
110 base::ThreadTicks::WaitUntilInitialized(); 111 base::ThreadTicks::WaitUntilInitialized();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 RunAllTests(prefixes.begin(), prefixes.end()); 205 RunAllTests(prefixes.begin(), prefixes.end());
205 } 206 }
206 207
207 TEST_F(HQPPerfTestOnePopularURL, Backspacing) { 208 TEST_F(HQPPerfTestOnePopularURL, Backspacing) {
208 std::string test_url = GeneratePopularURLRow().url().spec(); 209 std::string test_url = GeneratePopularURLRow().url().spec();
209 StringPieces prefixes = AllPrefixes(test_url); 210 StringPieces prefixes = AllPrefixes(test_url);
210 RunAllTests(prefixes.rbegin(), prefixes.rend()); 211 RunAllTests(prefixes.rbegin(), prefixes.rend());
211 } 212 }
212 213
213 } // namespace history 214 } // namespace history
OLDNEW
« no previous file with comments | « components/ntp_tiles/icon_cacher_impl_unittest.cc ('k') | components/omnibox/browser/zero_suggest_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698