Chromium Code Reviews| Index: components/ntp_tiles/popular_sites_impl_unittest.cc |
| diff --git a/components/ntp_tiles/popular_sites_impl_unittest.cc b/components/ntp_tiles/popular_sites_impl_unittest.cc |
| index 661cc2441bdd5f1890c07f4a92bb9d2c2abe3d27..836d2937bea6db10dc87da24b4a58bdf8ebd6ac7 100644 |
| --- a/components/ntp_tiles/popular_sites_impl_unittest.cc |
| +++ b/components/ntp_tiles/popular_sites_impl_unittest.cc |
| @@ -13,14 +13,12 @@ |
| #include "base/command_line.h" |
| #include "base/files/file_util.h" |
| #include "base/files/important_file_writer.h" |
|
mastiz
2017/06/21 04:44:22
Same for the two above.
fhorschig
2017/06/23 18:11:23
Gone.
|
| -#include "base/files/scoped_temp_dir.h" |
| #include "base/json/json_writer.h" |
| #include "base/memory/ptr_util.h" |
| #include "base/message_loop/message_loop.h" |
| #include "base/optional.h" |
| #include "base/run_loop.h" |
| #include "base/test/scoped_feature_list.h" |
| -#include "base/test/sequenced_worker_pool_owner.h" |
| #include "base/threading/thread_task_runner_handle.h" |
| #include "base/values.h" |
| #include "components/ntp_tiles/constants.h" |
| @@ -85,14 +83,11 @@ class PopularSitesTest : public ::testing::Test { |
| {kUrl, "https://www.chromium.org/"}, |
| {kFaviconUrl, "https://www.chromium.org/favicon.ico"}, |
| }, |
| - worker_pool_owner_(2, "PopularSitesTest."), |
| prefs_(new sync_preferences::TestingPrefServiceSyncable()), |
| url_fetcher_factory_(nullptr) { |
| base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| switches::kEnableNTPPopularSites); |
| PopularSitesImpl::RegisterProfilePrefs(prefs_->registry()); |
| - CHECK(scoped_cache_dir_.CreateUniqueTempDir()); |
| - cache_dir_ = scoped_cache_dir_.GetPath(); |
| } |
| void SetCountryAndVersion(const std::string& country, |
| @@ -161,9 +156,9 @@ class PopularSitesTest : public ::testing::Test { |
| std::unique_ptr<PopularSites> CreatePopularSites( |
| net::URLRequestContextGetter* context) { |
| return base::MakeUnique<PopularSitesImpl>( |
| - worker_pool_owner_.pool().get(), prefs_.get(), |
| + prefs_.get(), |
| /*template_url_service=*/nullptr, |
| - /*variations_service=*/nullptr, context, cache_dir_, |
| + /*variations_service=*/nullptr, context, |
| base::Bind(JsonUnsafeParser::Parse)); |
| } |
| @@ -172,9 +167,6 @@ class PopularSitesTest : public ::testing::Test { |
| const TestPopularSite kChromium; |
| base::MessageLoopForUI ui_loop_; |
| - base::SequencedWorkerPoolOwner worker_pool_owner_; |
| - base::ScopedTempDir scoped_cache_dir_; |
| - base::FilePath cache_dir_; |
| std::unique_ptr<sync_preferences::TestingPrefServiceSyncable> prefs_; |
| net::FakeURLFetcherFactory url_fetcher_factory_; |
| }; |
| @@ -309,22 +301,6 @@ TEST_F(PopularSitesTest, ProvidesDefaultSitesUntilCallbackReturns) { |
| EXPECT_THAT(popular_sites->sites().size(), Eq(1ul)); |
| } |
| -TEST_F(PopularSitesTest, ClearsCacheFileFromOldVersions) { |
| - SetCountryAndVersion("ZZ", "9"); |
| - RespondWithJSON( |
| - "https://www.gstatic.com/chrome/ntp/suggested_sites_ZZ_9.json", |
| - {kWikipedia}); |
| - |
| - PopularSites::SitesVector sites; |
| - const base::FilePath old_cache_path = |
| - cache_dir_.AppendASCII("suggested_sites.json"); |
| - CHECK(base::ImportantFileWriter::WriteFileAtomically(old_cache_path, |
| - "Old cache")); |
| - FetchPopularSites(/*force_download=*/false, &sites); |
| - worker_pool_owner_.pool()->FlushForTesting(); |
| - EXPECT_FALSE(base::PathExists(old_cache_path)); |
| -} |
| - |
| TEST_F(PopularSitesTest, UsesCachedJson) { |
| SetCountryAndVersion("ZZ", "9"); |
| RespondWithJSON( |