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

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

Issue 2638313002: Manage ServiceWorkerDispatcherHost in ServiceWorkerContextCore (Closed)
Patch Set: Add a newline Created 3 years, 11 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 <utility> 7 #include <utility>
8 8
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/browser/fileapi/mock_url_request_delegate.h" 10 #include "content/browser/fileapi/mock_url_request_delegate.h"
(...skipping 24 matching lines...) Expand all
35 35
36 class ServiceWorkerRequestHandlerTest : public testing::Test { 36 class ServiceWorkerRequestHandlerTest : public testing::Test {
37 public: 37 public:
38 ServiceWorkerRequestHandlerTest() 38 ServiceWorkerRequestHandlerTest()
39 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} 39 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {}
40 40
41 void SetUp() override { 41 void SetUp() override {
42 helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath())); 42 helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
43 43
44 // An empty host. 44 // An empty host.
45 std::unique_ptr<ServiceWorkerProviderHost> host( 45 std::unique_ptr<ServiceWorkerProviderHost> host =
46 new ServiceWorkerProviderHost( 46 ServiceWorkerProviderHost::CreateForTesting(
47 helper_->mock_render_process_id(), MSG_ROUTING_NONE, 47 helper_->mock_render_process_id(), kMockProviderId,
48 kMockProviderId, SERVICE_WORKER_PROVIDER_FOR_WINDOW, 48 SERVICE_WORKER_PROVIDER_FOR_WINDOW, context()->AsWeakPtr());
49 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, 49 host->set_parent_frame_secure(true);
50 context()->AsWeakPtr(), nullptr));
51 provider_host_ = host->AsWeakPtr(); 50 provider_host_ = host->AsWeakPtr();
52 context()->AddProviderHost(std::move(host)); 51 context()->AddProviderHost(std::move(host));
53 52
54 } 53 }
55 54
56 void TearDown() override { 55 void TearDown() override {
57 helper_.reset(); 56 helper_.reset();
58 } 57 }
59 58
60 ServiceWorkerContextCore* context() const { return helper_->context(); } 59 ServiceWorkerContextCore* context() const { return helper_->context(); }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Check provider host's URL after initializing a handler for an image. 160 // Check provider host's URL after initializing a handler for an image.
162 provider_host_->SetDocumentUrl(GURL("https://host/scope/doc")); 161 provider_host_->SetDocumentUrl(GURL("https://host/scope/doc"));
163 std::unique_ptr<net::URLRequest> request = 162 std::unique_ptr<net::URLRequest> request =
164 CreateRequest("https://host/scope/image", "GET"); 163 CreateRequest("https://host/scope/image", "GET");
165 InitializeHandler(request.get(), true, RESOURCE_TYPE_IMAGE); 164 InitializeHandler(request.get(), true, RESOURCE_TYPE_IMAGE);
166 ASSERT_FALSE(GetHandler(request.get())); 165 ASSERT_FALSE(GetHandler(request.get()));
167 EXPECT_EQ(GURL("https://host/scope/doc"), provider_host_->document_url()); 166 EXPECT_EQ(GURL("https://host/scope/doc"), provider_host_->document_url());
168 } 167 }
169 168
170 } // namespace content 169 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698