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

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

Issue 1135743002: Check the size of ResourceRecords in ServiceWorkerDatabase::ReadRegistration() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK in ServiceWorkerStorage::ReturnFoundRegistration() Created 5 years, 7 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
« no previous file with comments | « content/browser/service_worker/service_worker_url_request_job_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "content/browser/service_worker/embedded_worker_registry.h" 7 #include "content/browser/service_worker/embedded_worker_registry.h"
8 #include "content/browser/service_worker/embedded_worker_test_helper.h" 8 #include "content/browser/service_worker/embedded_worker_test_helper.h"
9 #include "content/browser/service_worker/service_worker_context_core.h" 9 #include "content/browser/service_worker/service_worker_context_core.h"
10 #include "content/browser/service_worker/service_worker_registration.h" 10 #include "content/browser/service_worker/service_worker_registration.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 pattern_ = GURL("http://www.example.com/"); 130 pattern_ = GURL("http://www.example.com/");
131 registration_ = new ServiceWorkerRegistration( 131 registration_ = new ServiceWorkerRegistration(
132 pattern_, 132 pattern_,
133 1L, 133 1L,
134 helper_->context()->AsWeakPtr()); 134 helper_->context()->AsWeakPtr());
135 version_ = new ServiceWorkerVersion( 135 version_ = new ServiceWorkerVersion(
136 registration_.get(), 136 registration_.get(),
137 GURL("http://www.example.com/service_worker.js"), 137 GURL("http://www.example.com/service_worker.js"),
138 1L, 138 1L,
139 helper_->context()->AsWeakPtr()); 139 helper_->context()->AsWeakPtr());
140 std::vector<ServiceWorkerDatabase::ResourceRecord> records;
141 records.push_back(
142 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100));
143 version_->script_cache_map()->SetResources(records);
140 144
141 // Make the registration findable via storage functions. 145 // Make the registration findable via storage functions.
142 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); 146 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing));
143 base::RunLoop().RunUntilIdle(); 147 base::RunLoop().RunUntilIdle();
144 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; 148 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
145 helper_->context()->storage()->StoreRegistration( 149 helper_->context()->storage()->StoreRegistration(
146 registration_.get(), 150 registration_.get(),
147 version_.get(), 151 version_.get(),
148 CreateReceiverOnCurrentThread(&status)); 152 CreateReceiverOnCurrentThread(&status));
149 base::RunLoop().RunUntilIdle(); 153 base::RunLoop().RunUntilIdle();
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 base::TimeTicks::Now() - 568 base::TimeTicks::Now() -
565 base::TimeDelta::FromMinutes( 569 base::TimeDelta::FromMinutes(
566 ServiceWorkerVersion::kStartWorkerTimeoutMinutes + 1); 570 ServiceWorkerVersion::kStartWorkerTimeoutMinutes + 1);
567 version_->timeout_timer_.user_task().Run(); 571 version_->timeout_timer_.user_task().Run();
568 base::RunLoop().RunUntilIdle(); 572 base::RunLoop().RunUntilIdle();
569 EXPECT_EQ(SERVICE_WORKER_ERROR_TIMEOUT, status); 573 EXPECT_EQ(SERVICE_WORKER_ERROR_TIMEOUT, status);
570 EXPECT_EQ(ServiceWorkerVersion::STOPPED, version_->running_status()); 574 EXPECT_EQ(ServiceWorkerVersion::STOPPED, version_->running_status());
571 } 575 }
572 576
573 } // namespace content 577 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_url_request_job_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698