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

Side by Side Diff: content/browser/service_worker/service_worker_url_request_job_unittest.cc

Issue 2375663002: Replace MessageLoop::current()->task_runner() with ThreadTaskRunnerHandle::Get(). (Closed)
Patch Set: rebase Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/service_worker/service_worker_url_request_job.h" 5 #include "content/browser/service_worker/service_worker_url_request_job.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/message_loop/message_loop.h"
17 #include "base/run_loop.h" 16 #include "base/run_loop.h"
18 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
19 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
20 #include "base/time/time.h" 19 #include "base/time/time.h"
21 #include "content/browser/blob_storage/chrome_blob_storage_context.h" 20 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
22 #include "content/browser/fileapi/mock_url_request_delegate.h" 21 #include "content/browser/fileapi/mock_url_request_delegate.h"
23 #include "content/browser/resource_context_impl.h" 22 #include "content/browser/resource_context_impl.h"
24 #include "content/browser/service_worker/embedded_worker_registry.h" 23 #include "content/browser/service_worker/embedded_worker_registry.h"
25 #include "content/browser/service_worker/embedded_worker_test_helper.h" 24 #include "content/browser/service_worker/embedded_worker_test_helper.h"
26 #include "content/browser/service_worker/service_worker_context_core.h" 25 #include "content/browser/service_worker/service_worker_context_core.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 &url_request_delegate_); 300 &url_request_delegate_);
302 request_->set_method("GET"); 301 request_->set_method("GET");
303 request_->Start(); 302 request_->Start();
304 303
305 // Proceed until the job starts waiting for the worker to activate. 304 // Proceed until the job starts waiting for the worker to activate.
306 base::RunLoop().RunUntilIdle(); 305 base::RunLoop().RunUntilIdle();
307 306
308 // Simulate another worker kicking out the incumbent worker. PostTask since 307 // Simulate another worker kicking out the incumbent worker. PostTask since
309 // it might respond synchronously, and the MockURLRequestDelegate would 308 // it might respond synchronously, and the MockURLRequestDelegate would
310 // complain that the message loop isn't being run. 309 // complain that the message loop isn't being run.
311 base::MessageLoop::current()->task_runner()->PostTask( 310 base::ThreadTaskRunnerHandle::Get()->PostTask(
312 FROM_HERE, base::Bind(&ServiceWorkerVersion::SetStatus, version_, 311 FROM_HERE, base::Bind(&ServiceWorkerVersion::SetStatus, version_,
313 ServiceWorkerVersion::REDUNDANT)); 312 ServiceWorkerVersion::REDUNDANT));
314 base::RunLoop().RunUntilIdle(); 313 base::RunLoop().RunUntilIdle();
315 } 314 }
316 315
317 TestBrowserThreadBundle thread_bundle_; 316 TestBrowserThreadBundle thread_bundle_;
318 317
319 std::unique_ptr<TestBrowserContext> browser_context_; 318 std::unique_ptr<TestBrowserContext> browser_context_;
320 std::unique_ptr<EmbeddedWorkerTestHelper> helper_; 319 std::unique_ptr<EmbeddedWorkerTestHelper> helper_;
321 scoped_refptr<ServiceWorkerRegistration> registration_; 320 scoped_refptr<ServiceWorkerRegistration> registration_;
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 base::RunLoop().RunUntilIdle(); 1048 base::RunLoop().RunUntilIdle();
1050 1049
1051 // The fetch event request should no longer be in-flight. 1050 // The fetch event request should no longer be in-flight.
1052 EXPECT_FALSE(version_->HasWork()); 1051 EXPECT_FALSE(version_->HasWork());
1053 } 1052 }
1054 1053
1055 // TODO(kinuko): Add more tests with different response data and also for 1054 // TODO(kinuko): Add more tests with different response data and also for
1056 // FallbackToNetwork case. 1055 // FallbackToNetwork case.
1057 1056
1058 } // namespace content 1057 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698