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

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

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: change useCache to updateViaCache Created 3 years, 6 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 <tuple> 5 #include <tuple>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/browser/service_worker/embedded_worker_registry.h" 10 #include "content/browser/service_worker/embedded_worker_registry.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 void SetUp() override { 72 void SetUp() override {
73 helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath())); 73 helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
74 74
75 dispatcher_host_ = new TestingServiceWorkerDispatcherHost( 75 dispatcher_host_ = new TestingServiceWorkerDispatcherHost(
76 helper_->mock_render_process_id(), &resource_context_, helper_.get()); 76 helper_->mock_render_process_id(), &resource_context_, helper_.get());
77 helper_->RegisterDispatcherHost(helper_->mock_render_process_id(), 77 helper_->RegisterDispatcherHost(helper_->mock_render_process_id(),
78 dispatcher_host_); 78 dispatcher_host_);
79 dispatcher_host_->Init(helper_->context_wrapper()); 79 dispatcher_host_->Init(helper_->context_wrapper());
80 80
81 const GURL pattern("http://www.example.com/"); 81 const GURL pattern("http://www.example.com/");
82 registration_ = new ServiceWorkerRegistration( 82 registration_ =
83 pattern, 83 new ServiceWorkerRegistration(ServiceWorkerRegistrationOptions(pattern),
84 1L, 84 1L, helper_->context()->AsWeakPtr());
85 helper_->context()->AsWeakPtr());
86 version_ = new ServiceWorkerVersion( 85 version_ = new ServiceWorkerVersion(
87 registration_.get(), 86 registration_.get(),
88 GURL("http://www.example.com/service_worker.js"), 87 GURL("http://www.example.com/service_worker.js"),
89 1L, 88 1L,
90 helper_->context()->AsWeakPtr()); 89 helper_->context()->AsWeakPtr());
91 std::vector<ServiceWorkerDatabase::ResourceRecord> records; 90 std::vector<ServiceWorkerDatabase::ResourceRecord> records;
92 records.push_back( 91 records.push_back(
93 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); 92 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100));
94 version_->script_cache_map()->SetResources(records); 93 version_->script_cache_map()->SetResources(records);
95 version_->SetMainScriptHttpResponseInfo(net::HttpResponseInfo()); 94 version_->SetMainScriptHttpResponseInfo(net::HttpResponseInfo());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // StartWorker shouldn't be recorded here. 160 // StartWorker shouldn't be recorded here.
162 ASSERT_EQ(1UL, ipc_sink()->message_count()); 161 ASSERT_EQ(1UL, ipc_sink()->message_count());
163 message = ipc_sink()->GetMessageAt(0); 162 message = ipc_sink()->GetMessageAt(0);
164 163
165 // StateChanged (state == Installed). 164 // StateChanged (state == Installed).
166 VerifyStateChangedMessage(handle->handle_id(), 165 VerifyStateChangedMessage(handle->handle_id(),
167 blink::kWebServiceWorkerStateInstalled, message); 166 blink::kWebServiceWorkerStateInstalled, message);
168 } 167 }
169 168
170 } // namespace content 169 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698