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

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

Issue 508433002: Remove implicit conversions from scoped_refptr to T* in content/browser/service_worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/browser/fileapi/chrome_blob_storage_context.h" 10 #include "content/browser/fileapi/chrome_blob_storage_context.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 FetchOnRegisteredWorker(result, response, blob_data_handle); 491 FetchOnRegisteredWorker(result, response, blob_data_handle);
492 } 492 }
493 493
494 void SetUpRegistrationOnIOThread(const std::string& worker_url) { 494 void SetUpRegistrationOnIOThread(const std::string& worker_url) {
495 registration_ = new ServiceWorkerRegistration( 495 registration_ = new ServiceWorkerRegistration(
496 embedded_test_server()->GetURL("/"), 496 embedded_test_server()->GetURL("/"),
497 embedded_test_server()->GetURL(worker_url), 497 embedded_test_server()->GetURL(worker_url),
498 wrapper()->context()->storage()->NewRegistrationId(), 498 wrapper()->context()->storage()->NewRegistrationId(),
499 wrapper()->context()->AsWeakPtr()); 499 wrapper()->context()->AsWeakPtr());
500 version_ = new ServiceWorkerVersion( 500 version_ = new ServiceWorkerVersion(
501 registration_, 501 registration_.get(),
502 wrapper()->context()->storage()->NewVersionId(), 502 wrapper()->context()->storage()->NewVersionId(),
503 wrapper()->context()->AsWeakPtr()); 503 wrapper()->context()->AsWeakPtr());
504 AssociateRendererProcessToWorker(version_->embedded_worker()); 504 AssociateRendererProcessToWorker(version_->embedded_worker());
505 } 505 }
506 506
507 void StartOnIOThread(const base::Closure& done, 507 void StartOnIOThread(const base::Closure& done,
508 ServiceWorkerStatusCode* result) { 508 ServiceWorkerStatusCode* result) {
509 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); 509 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
510 version_->StartWorker(CreateReceiver(BrowserThread::UI, done, result)); 510 version_->StartWorker(CreateReceiver(BrowserThread::UI, done, result));
511 } 511 }
(...skipping 17 matching lines...) Expand all
529 void FetchOnIOThread(const base::Closure& done, FetchResult* result) { 529 void FetchOnIOThread(const base::Closure& done, FetchResult* result) {
530 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); 530 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
531 ServiceWorkerFetchRequest request( 531 ServiceWorkerFetchRequest request(
532 embedded_test_server()->GetURL("/service_worker/empty.html"), 532 embedded_test_server()->GetURL("/service_worker/empty.html"),
533 "GET", 533 "GET",
534 std::map<std::string, std::string>(), 534 std::map<std::string, std::string>(),
535 GURL(""), 535 GURL(""),
536 false); 536 false);
537 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); 537 version_->SetStatus(ServiceWorkerVersion::ACTIVATED);
538 version_->DispatchFetchEvent( 538 version_->DispatchFetchEvent(
539 request, CreateResponseReceiver(BrowserThread::UI, done, 539 request,
540 blob_context_, result)); 540 CreateResponseReceiver(
541 BrowserThread::UI, done, blob_context_.get(), result));
541 } 542 }
542 543
543 void StopOnIOThread(const base::Closure& done, 544 void StopOnIOThread(const base::Closure& done,
544 ServiceWorkerStatusCode* result) { 545 ServiceWorkerStatusCode* result) {
545 ASSERT_TRUE(version_); 546 ASSERT_TRUE(version_.get());
546 version_->StopWorker(CreateReceiver(BrowserThread::UI, done, result)); 547 version_->StopWorker(CreateReceiver(BrowserThread::UI, done, result));
547 } 548 }
548 549
549 void SyncEventOnIOThread(const base::Closure& done, 550 void SyncEventOnIOThread(const base::Closure& done,
550 ServiceWorkerStatusCode* result) { 551 ServiceWorkerStatusCode* result) {
551 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); 552 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
552 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); 553 version_->SetStatus(ServiceWorkerVersion::ACTIVATED);
553 version_->DispatchSyncEvent( 554 version_->DispatchSyncEvent(
554 CreateReceiver(BrowserThread::UI, done, result)); 555 CreateReceiver(BrowserThread::UI, done, result));
555 } 556 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 continuation)); 835 continuation));
835 } 836 }
836 837
837 void FindRegistrationOnIO2( 838 void FindRegistrationOnIO2(
838 ServiceWorkerStatusCode* out_status, 839 ServiceWorkerStatusCode* out_status,
839 GURL* script_url, 840 GURL* script_url,
840 const base::Closure& continuation, 841 const base::Closure& continuation,
841 ServiceWorkerStatusCode status, 842 ServiceWorkerStatusCode status,
842 const scoped_refptr<ServiceWorkerRegistration>& registration) { 843 const scoped_refptr<ServiceWorkerRegistration>& registration) {
843 *out_status = status; 844 *out_status = status;
844 if (registration) { 845 if (registration.get()) {
845 *script_url = registration->script_url(); 846 *script_url = registration->script_url();
846 } else { 847 } else {
847 EXPECT_NE(SERVICE_WORKER_OK, status); 848 EXPECT_NE(SERVICE_WORKER_OK, status);
848 } 849 }
849 continuation.Run(); 850 continuation.Run();
850 } 851 }
851 }; 852 };
852 853
853 static int CountRenderProcessHosts() { 854 static int CountRenderProcessHosts() {
854 int result = 0; 855 int result = 0;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO, 940 base::Bind(&ServiceWorkerBlackBoxBrowserTest::FindRegistrationOnIO,
940 this, 941 this,
941 embedded_test_server()->GetURL("/service_worker/empty.html"), 942 embedded_test_server()->GetURL("/service_worker/empty.html"),
942 &status, 943 &status,
943 &script_url)); 944 &script_url));
944 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status); 945 EXPECT_EQ(SERVICE_WORKER_ERROR_NOT_FOUND, status);
945 } 946 }
946 } 947 }
947 948
948 } // namespace content 949 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698