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

Side by Side Diff: components/ntp_tiles/popular_sites_unittest.cc

Issue 2562733003: Remove duplicated user_prefs::TestingPrefServiceSyncable (Closed)
Patch Set: Fixed usage from .mm files Created 4 years 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
« no previous file with comments | « components/ntp_tiles/DEPS ('k') | components/password_manager/sync/browser/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ntp_tiles/popular_sites.h" 5 #include "components/ntp_tiles/popular_sites.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/test/sequenced_worker_pool_owner.h" 15 #include "base/test/sequenced_worker_pool_owner.h"
16 #include "base/threading/thread_task_runner_handle.h" 16 #include "base/threading/thread_task_runner_handle.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "components/ntp_tiles/json_unsafe_parser.h" 18 #include "components/ntp_tiles/json_unsafe_parser.h"
19 #include "components/ntp_tiles/pref_names.h" 19 #include "components/ntp_tiles/pref_names.h"
20 #include "components/pref_registry/pref_registry_syncable.h" 20 #include "components/pref_registry/pref_registry_syncable.h"
21 #include "components/pref_registry/testing_pref_service_syncable.h" 21 #include "components/sync_preferences/testing_pref_service_syncable.h"
22 #include "net/http/http_status_code.h" 22 #include "net/http/http_status_code.h"
23 #include "net/url_request/test_url_fetcher_factory.h" 23 #include "net/url_request/test_url_fetcher_factory.h"
24 #include "net/url_request/url_request_status.h" 24 #include "net/url_request/url_request_status.h"
25 #include "net/url_request/url_request_test_util.h" 25 #include "net/url_request/url_request_test_util.h"
26 #include "testing/gmock/include/gmock/gmock.h" 26 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
28 28
29 using testing::Eq; 29 using testing::Eq;
30 using testing::IsEmpty; 30 using testing::IsEmpty;
31 31
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 133
134 const TestPopularSite kWikipedia; 134 const TestPopularSite kWikipedia;
135 const TestPopularSite kYouTube; 135 const TestPopularSite kYouTube;
136 const TestPopularSite kChromium; 136 const TestPopularSite kChromium;
137 137
138 base::MessageLoopForUI ui_loop_; 138 base::MessageLoopForUI ui_loop_;
139 base::SequencedWorkerPoolOwner worker_pool_owner_; 139 base::SequencedWorkerPoolOwner worker_pool_owner_;
140 base::ScopedTempDir scoped_cache_dir_; 140 base::ScopedTempDir scoped_cache_dir_;
141 base::FilePath cache_dir_; 141 base::FilePath cache_dir_;
142 user_prefs::TestingPrefServiceSyncable prefs_; 142 sync_preferences::TestingPrefServiceSyncable prefs_;
143 net::FakeURLFetcherFactory url_fetcher_factory_; 143 net::FakeURLFetcherFactory url_fetcher_factory_;
144 }; 144 };
145 145
146 TEST_F(PopularSitesTest, Basic) { 146 TEST_F(PopularSitesTest, Basic) {
147 SetCountryAndVersion("ZZ", "9"); 147 SetCountryAndVersion("ZZ", "9");
148 RespondWithJSON( 148 RespondWithJSON(
149 "https://www.gstatic.com/chrome/ntp/suggested_sites_ZZ_9.json", 149 "https://www.gstatic.com/chrome/ntp/suggested_sites_ZZ_9.json",
150 {kWikipedia}); 150 {kWikipedia});
151 151
152 std::vector<PopularSites::Site> sites; 152 std::vector<PopularSites::Site> sites;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 RespondWithJSON( 320 RespondWithJSON(
321 "https://www.gstatic.com/chrome/ntp/suggested_sites_ZZ_9.json", 321 "https://www.gstatic.com/chrome/ntp/suggested_sites_ZZ_9.json",
322 {kChromium}); 322 {kChromium});
323 EXPECT_TRUE(FetchPopularSites(/*force_download=*/false, &sites)); 323 EXPECT_TRUE(FetchPopularSites(/*force_download=*/false, &sites));
324 ASSERT_THAT(sites.size(), Eq(1u)); 324 ASSERT_THAT(sites.size(), Eq(1u));
325 EXPECT_THAT(sites[0].url, URLEq("https://www.chromium.org/")); 325 EXPECT_THAT(sites[0].url, URLEq("https://www.chromium.org/"));
326 } 326 }
327 327
328 } // namespace 328 } // namespace
329 } // namespace ntp_tiles 329 } // namespace ntp_tiles
OLDNEW
« no previous file with comments | « components/ntp_tiles/DEPS ('k') | components/password_manager/sync/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698