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

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

Issue 1221643014: Service Worker: Migrate to version_uuid and surface ServiceWorker.id. (Chromium 2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 void SetUpWithHelper(EmbeddedWorkerTestHelper* helper, 125 void SetUpWithHelper(EmbeddedWorkerTestHelper* helper,
126 bool set_main_script_http_response_info = true) { 126 bool set_main_script_http_response_info = true) {
127 helper_.reset(helper); 127 helper_.reset(helper);
128 128
129 registration_ = new ServiceWorkerRegistration( 129 registration_ = new ServiceWorkerRegistration(
130 GURL("http://example.com/"), 130 GURL("http://example.com/"),
131 1L, 131 1L,
132 helper_->context()->AsWeakPtr()); 132 helper_->context()->AsWeakPtr());
133 version_ = new ServiceWorkerVersion( 133 version_ = new ServiceWorkerVersion(
134 registration_.get(), 134 registration_.get(), GURL("http://example.com/service_worker.js"),
135 GURL("http://example.com/service_worker.js"), 135 std::string("3753e33b-532e-4499-92b8-96ea1d343fe5"),
136 1L,
137 helper_->context()->AsWeakPtr()); 136 helper_->context()->AsWeakPtr());
138 std::vector<ServiceWorkerDatabase::ResourceRecord> records; 137 std::vector<ServiceWorkerDatabase::ResourceRecord> records;
139 records.push_back( 138 records.push_back(
140 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); 139 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100));
141 version_->script_cache_map()->SetResources(records); 140 version_->script_cache_map()->SetResources(records);
142 141
143 // Make the registration findable via storage functions. 142 // Make the registration findable via storage functions.
144 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); 143 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing));
145 base::RunLoop().RunUntilIdle(); 144 base::RunLoop().RunUntilIdle();
146 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; 145 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 base::RunLoop().RunUntilIdle(); 659 base::RunLoop().RunUntilIdle();
661 EXPECT_TRUE(request_->status().is_success()); 660 EXPECT_TRUE(request_->status().is_success());
662 EXPECT_EQ(200, request_->GetResponseCode()); 661 EXPECT_EQ(200, request_->GetResponseCode());
663 EXPECT_EQ("", url_request_delegate_.response_data()); 662 EXPECT_EQ("", url_request_delegate_.response_data());
664 } 663 }
665 664
666 // TODO(kinuko): Add more tests with different response data and also for 665 // TODO(kinuko): Add more tests with different response data and also for
667 // FallbackToNetwork case. 666 // FallbackToNetwork case.
668 667
669 } // namespace content 668 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698