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

Side by Side Diff: components/precache/content/precache_manager_unittest.cc

Issue 2317123002: c/browser, c/common, components O-P: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased Created 4 years, 3 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/precache/content/precache_manager.h" 5 #include "components/precache/content/precache_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void SetUp() override { 171 void SetUp() override {
172 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 172 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
173 switches::kPrecacheConfigSettingsURL, kConfigURL); 173 switches::kPrecacheConfigSettingsURL, kConfigURL);
174 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 174 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
175 switches::kPrecacheManifestURLPrefix, kManifestURLPrefix); 175 switches::kPrecacheManifestURLPrefix, kManifestURLPrefix);
176 std::unique_ptr<PrecacheDatabase> precache_database( 176 std::unique_ptr<PrecacheDatabase> precache_database(
177 new PrecacheDatabase()); 177 new PrecacheDatabase());
178 precache_database_ = precache_database.get(); 178 precache_database_ = precache_database.get();
179 179
180 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); 180 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir());
181 base::FilePath db_path = scoped_temp_dir_.path().Append( 181 base::FilePath db_path = scoped_temp_dir_.GetPath().Append(
182 base::FilePath(FILE_PATH_LITERAL("precache_database"))); 182 base::FilePath(FILE_PATH_LITERAL("precache_database")));
183 183
184 // Make the fetch of the precache configuration settings fail. Precaching 184 // Make the fetch of the precache configuration settings fail. Precaching
185 // should still complete normally in this case. 185 // should still complete normally in this case.
186 factory_.SetFakeResponse(GURL(kConfigURL), "", 186 factory_.SetFakeResponse(GURL(kConfigURL), "",
187 net::HTTP_INTERNAL_SERVER_ERROR, 187 net::HTTP_INTERNAL_SERVER_ERROR,
188 net::URLRequestStatus::FAILED); 188 net::URLRequestStatus::FAILED);
189 precache_manager_.reset( 189 precache_manager_.reset(
190 new PrecacheManagerUnderTest( 190 new PrecacheManagerUnderTest(
191 &browser_context_, nullptr /* sync_service */, 191 &browser_context_, nullptr /* sync_service */,
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 expected_histogram_count_map["Precache.Saved"] += 2; 561 expected_histogram_count_map["Precache.Saved"] += 2;
562 expected_histogram_count_map["Precache.TimeSinceLastPrecache"] += 2; 562 expected_histogram_count_map["Precache.TimeSinceLastPrecache"] += 2;
563 expected_histogram_count_map["Precache.Saved.Freshness"] = 2; 563 expected_histogram_count_map["Precache.Saved.Freshness"] = 2;
564 564
565 base::RunLoop().RunUntilIdle(); 565 base::RunLoop().RunUntilIdle();
566 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."), 566 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."),
567 ContainerEq(expected_histogram_count_map)); 567 ContainerEq(expected_histogram_count_map));
568 } 568 }
569 569
570 } // namespace precache 570 } // namespace precache
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_loader_win_unittest.cc ('k') | components/precache/core/precache_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698