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

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

Issue 1106723002: ServiceWorker: Decompose SWRegistration::SetVersionInternal for readability (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make the argument const-ref Created 5 years, 8 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_request_handler.h" 5 #include "content/browser/service_worker/service_worker_request_handler.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "content/browser/fileapi/mock_url_request_delegate.h" 8 #include "content/browser/fileapi/mock_url_request_delegate.h"
9 #include "content/browser/service_worker/embedded_worker_test_helper.h" 9 #include "content/browser/service_worker/embedded_worker_test_helper.h"
10 #include "content/browser/service_worker/service_worker_context_core.h" 10 #include "content/browser/service_worker/service_worker_context_core.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 kMockRenderProcessId, MSG_ROUTING_NONE, kMockProviderId, 54 kMockRenderProcessId, MSG_ROUTING_NONE, kMockProviderId,
55 SERVICE_WORKER_PROVIDER_FOR_WINDOW, context()->AsWeakPtr(), nullptr)); 55 SERVICE_WORKER_PROVIDER_FOR_WINDOW, context()->AsWeakPtr(), nullptr));
56 host->SetDocumentUrl(GURL("http://host/scope/")); 56 host->SetDocumentUrl(GURL("http://host/scope/"));
57 provider_host_ = host->AsWeakPtr(); 57 provider_host_ = host->AsWeakPtr();
58 context()->AddProviderHost(host.Pass()); 58 context()->AddProviderHost(host.Pass());
59 59
60 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); 60 context()->storage()->LazyInitialize(base::Bind(&EmptyCallback));
61 base::RunLoop().RunUntilIdle(); 61 base::RunLoop().RunUntilIdle();
62 62
63 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); 63 version_->SetStatus(ServiceWorkerVersion::ACTIVATED);
64 registration_->SetActiveVersion(version_.get()); 64 registration_->SetActiveVersion(version_);
65 context()->storage()->StoreRegistration( 65 context()->storage()->StoreRegistration(
66 registration_.get(), 66 registration_.get(),
67 version_.get(), 67 version_.get(),
68 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 68 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
69 provider_host_->AssociateRegistration(registration_.get(), 69 provider_host_->AssociateRegistration(registration_.get(),
70 false /* notify_controllerchange */); 70 false /* notify_controllerchange */);
71 base::RunLoop().RunUntilIdle(); 71 base::RunLoop().RunUntilIdle();
72 } 72 }
73 73
74 void TearDown() override { 74 void TearDown() override {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 provider_host_->SetDocumentUrl(GURL("")); 153 provider_host_->SetDocumentUrl(GURL(""));
154 EXPECT_FALSE(InitializeHandlerCheck( 154 EXPECT_FALSE(InitializeHandlerCheck(
155 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); 155 "http://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE));
156 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); 156 EXPECT_STREQ("", provider_host_->document_url().spec().c_str());
157 EXPECT_FALSE(InitializeHandlerCheck( 157 EXPECT_FALSE(InitializeHandlerCheck(
158 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE)); 158 "https://host/scope/doc", "GET", true, RESOURCE_TYPE_IMAGE));
159 EXPECT_STREQ("", provider_host_->document_url().spec().c_str()); 159 EXPECT_STREQ("", provider_host_->document_url().spec().c_str());
160 } 160 }
161 161
162 } // namespace content 162 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698