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

Side by Side Diff: content/browser/service_worker/service_worker_data_pipe_reader_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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_data_pipe_reader.h" 5 #include "content/browser/service_worker/service_worker_data_pipe_reader.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.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_context_wrapper.h" 10 #include "content/browser/service_worker/service_worker_context_wrapper.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 : public testing::Test, 70 : public testing::Test,
71 public ServiceWorkerURLRequestJob::Delegate { 71 public ServiceWorkerURLRequestJob::Delegate {
72 public: 72 public:
73 ServiceWorkerDataPipeReaderTest() 73 ServiceWorkerDataPipeReaderTest()
74 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} 74 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {}
75 75
76 void SetUp() override { 76 void SetUp() override {
77 helper_ = base::MakeUnique<EmbeddedWorkerTestHelper>(base::FilePath()); 77 helper_ = base::MakeUnique<EmbeddedWorkerTestHelper>(base::FilePath());
78 mock_url_request_job_ = 78 mock_url_request_job_ =
79 base::MakeUnique<MockServiceWorkerURLRequestJob>(this); 79 base::MakeUnique<MockServiceWorkerURLRequestJob>(this);
80 ServiceWorkerRegistrationOptions options(GURL("https://example.com/"));
80 registration_ = new ServiceWorkerRegistration( 81 registration_ = new ServiceWorkerRegistration(
81 GURL("https://example.com/"), 1L, helper_->context()->AsWeakPtr()); 82 options, 1L, helper_->context()->AsWeakPtr());
82 version_ = new ServiceWorkerVersion( 83 version_ = new ServiceWorkerVersion(
83 registration_.get(), GURL("https://example.com/service_worker.js"), 1L, 84 registration_.get(), GURL("https://example.com/service_worker.js"), 1L,
84 helper_->context()->AsWeakPtr()); 85 helper_->context()->AsWeakPtr());
85 std::vector<ServiceWorkerDatabase::ResourceRecord> records; 86 std::vector<ServiceWorkerDatabase::ResourceRecord> records;
86 records.push_back( 87 records.push_back(
87 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); 88 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100));
88 version_->script_cache_map()->SetResources(records); 89 version_->script_cache_map()->SetResources(records);
89 version_->set_fetch_handler_existence( 90 version_->set_fetch_handler_existence(
90 ServiceWorkerVersion::FetchHandlerExistence::EXISTS); 91 ServiceWorkerVersion::FetchHandlerExistence::EXISTS);
91 } 92 }
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 ASSERT_EQ(1UL, mock_url_request_job()->results().size()); 406 ASSERT_EQ(1UL, mock_url_request_job()->results().size());
406 EXPECT_EQ(ServiceWorkerMetrics::REQUEST_JOB_ERROR_STREAM_ABORTED, 407 EXPECT_EQ(ServiceWorkerMetrics::REQUEST_JOB_ERROR_STREAM_ABORTED,
407 mock_url_request_job()->results()[0]); 408 mock_url_request_job()->results()[0]);
408 } 409 }
409 410
410 INSTANTIATE_TEST_CASE_P(ServiceWorkerDataPipeReaderTest, 411 INSTANTIATE_TEST_CASE_P(ServiceWorkerDataPipeReaderTest,
411 ServiceWorkerDataPipeReaderTestP, 412 ServiceWorkerDataPipeReaderTestP,
412 testing::Combine(testing::Bool(), testing::Bool())); 413 testing::Combine(testing::Bool(), testing::Bool()));
413 414
414 } // namespace content 415 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698