OLD | NEW |
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/core/precache_fetcher.h" | 5 #include "components/precache/core/precache_fetcher.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <cstring> | 9 #include <cstring> |
10 #include <memory> | 10 #include <memory> |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 info.was_cached = true; | 364 info.was_cached = true; |
365 info.headers = new net::HttpResponseHeaders(std::string()); | 365 info.headers = new net::HttpResponseHeaders(std::string()); |
366 precache_database_.RecordURLNonPrefetch( | 366 precache_database_.RecordURLNonPrefetch( |
367 url, base::TimeDelta(), base::Time::Now(), info, 1000 /* size */, | 367 url, base::TimeDelta(), base::Time::Now(), info, 1000 /* size */, |
368 0 /* host_rank */, false /* is_connection_cellular */); | 368 0 /* host_rank */, false /* is_connection_cellular */); |
369 } | 369 } |
370 | 370 |
371 protected: | 371 protected: |
372 void SetUp() override { | 372 void SetUp() override { |
373 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); | 373 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); |
374 base::FilePath db_path = scoped_temp_dir_.path().Append( | 374 base::FilePath db_path = scoped_temp_dir_.GetPath().Append( |
375 base::FilePath(FILE_PATH_LITERAL("precache_database"))); | 375 base::FilePath(FILE_PATH_LITERAL("precache_database"))); |
376 precache_database_.Init(db_path); | 376 precache_database_.Init(db_path); |
377 } | 377 } |
378 void SetDefaultFlags() { | 378 void SetDefaultFlags() { |
379 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 379 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
380 switches::kPrecacheConfigSettingsURL, kConfigURL); | 380 switches::kPrecacheConfigSettingsURL, kConfigURL); |
381 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 381 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
382 switches::kPrecacheManifestURLPrefix, kManifestURLPrefix); | 382 switches::kPrecacheManifestURLPrefix, kManifestURLPrefix); |
383 } | 383 } |
384 | 384 |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 request_context_.get(), GURL(), std::string(), | 1283 request_context_.get(), GURL(), std::string(), |
1284 std::move(unfinished_work), kExperimentID, | 1284 std::move(unfinished_work), kExperimentID, |
1285 precache_database_.GetWeakPtr(), task_runner(), &precache_delegate_); | 1285 precache_database_.GetWeakPtr(), task_runner(), &precache_delegate_); |
1286 precache_fetcher.Start(); | 1286 precache_fetcher.Start(); |
1287 | 1287 |
1288 base::RunLoop().RunUntilIdle(); | 1288 base::RunLoop().RunUntilIdle(); |
1289 } | 1289 } |
1290 } | 1290 } |
1291 | 1291 |
1292 } // namespace precache | 1292 } // namespace precache |
OLD | NEW |