Chromium Code Reviews| Index: content/browser/service_worker/foreign_fetch_request_handler_unittest.cc |
| diff --git a/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc b/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc |
| index cdf3bc48a5fadb166da6f4c30b85660ee1629112..b03a983cbf126782c70befd9b37450c8425fef9c 100644 |
| --- a/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc |
| +++ b/content/browser/service_worker/foreign_fetch_request_handler_unittest.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/memory/ptr_util.h" |
| #include "base/run_loop.h" |
| +#include "base/test/simple_test_clock.h" |
| #include "base/test/simple_test_tick_clock.h" |
| #include "content/browser/browser_thread_impl.h" |
| #include "content/browser/service_worker/embedded_worker_test_helper.h" |
| @@ -50,6 +51,10 @@ int kMockProviderId = 1; |
| const char* kValidUrl = "https://valid.example.com/foo/bar"; |
| +// This timestamp is set to a time after the expiry timestamp of the expired |
| +// tokens in this test, but before the expiry timestamp of the valid ones. |
| +double kNowTimestamp = 1500000000; |
| + |
| void EmptyCallback() {} |
| } // namespace |
| @@ -79,6 +84,11 @@ class ForeignFetchRequestHandlerTest : public testing::Test { |
| kVersionId, context()->AsWeakPtr()); |
| version_->set_foreign_fetch_scopes({kScope}); |
| + // Fix the time for testing to kNowTimestamp |
| + base::SimpleTestClock* clock = new base::SimpleTestClock(); |
| + clock->SetNow(base::Time::FromDoubleT(kNowTimestamp)); |
| + version_->SetClockForTesting(base::WrapUnique(clock)); |
|
Marijn Kruisselbrink
2017/08/02 19:57:25
why WrapUnique here, and not simply base::MakeUniq
iclelland
2017/08/02 20:22:05
Because I need to call SetNow() on it -- if I make
Marijn Kruisselbrink
2017/08/02 20:34:20
Yeah, that's what I meant. std::unique_ptr<Foo> is
|
| + |
| context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); |
| base::RunLoop().RunUntilIdle(); |